Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jasper file created is empty #50

Open
neo7BF opened this issue Nov 15, 2023 · 5 comments
Open

Jasper file created is empty #50

neo7BF opened this issue Nov 15, 2023 · 5 comments
Assignees

Comments

@neo7BF
Copy link

neo7BF commented Nov 15, 2023

I'm using this plugin in a spring web application and it produces empty .jasper files while with the original official plugin (in beta) they are produced correctly.
Can you tell me what the problem is?

Thank you.

Java version:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>

Jasper Reports version used:

<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>6.20.5</version>
</dependency>

New plugin configuration (produces empty .jasper files):

<plugins>
<plugin>
<groupId>com.pro-crafting.tools</groupId>
<artifactId>jasperreports-plugin</artifactId>
<version>3.5.6</version>
<executions>
<execution>
<phase>process-sources</phase>
<goals>
<goal>jasper</goal>
</goals>
</execution>
</executions>
<configuration>
<compiler>net.sf.jasperreports.engine.design.JRJdtCompiler</compiler>
<sourceDirectory>src/main/webapp/resources/jasperreports</sourceDirectory>
<outputDirectory>src/main/webapp/resources/jasper-compiled</outputDirectory>
<outputFileExt>.jasper</outputFileExt>
<xmlValidation>true</xmlValidation>
<verbose>false</verbose>
<numberOfThreads>4</numberOfThreads>
<failOnMissingSourceDirectory>true</failOnMissingSourceDirectory>
<sourceScanner>org.codehaus.plexus.compiler.util.scan.StaleSourceScanner</sourceScanner>
</configuration>
</plugin>
</plugins>

<repositories>
     <repository>
         <id>jaspersoft-third-party</id>
         <url>https://jaspersoft.jfrog.io/jaspersoft/third-party-ce-artifacts/</url>
     </repository>
</repositories>

Old plugin configuration (jasper files are produced correctly):

             <plugin>
                 <groupId>org.codehaus.mojo</groupId>
                 <artifactId>jasperreports-maven-plugin</artifactId>
                 <version>1.0-beta-2</version>
                 <configuration>
<sourceDirectory>src/main/webapp/resources/jasperreports</sourceDirectory>
<outputDirectory>src/main/webapp/resources/jasper-compiled</outputDirectory>
                 </configuration>
                 <executions>
                     <execution>
                         <phase>compile</phase>
                         <goals>
                             <goal>compile-reports</goal>
                         </goals>
                     </execution>
                 </executions>
                 <dependencies>
                     <dependency>
                         <groupId>net.sf.jasperreports</groupId>
                         <artifactId>jasperreports</artifactId>
                         <version>6.20.5</version>
                     </dependency>
                     <dependency>
                         <groupId>org.codehaus.groovy</groupId>
                         <artifactId>groovy-all</artifactId>
                         <version>2.0.1</version>
                         <scope>compile</scope>
                         <optional>true</optional>
                     </dependency>
                 </dependencies>
             </plugin>
@LeonardoALARCON
Copy link

LeonardoALARCON commented Nov 20, 2023

I had the same problem and I fixed it by deleting the configuraton parameter <sourceScanner>org.codehaus.plexus.compiler.util.scan.StaleSourceScanner</sourceScanner>. It works because 'org.codehaus.plexus.compiler.util.scan.StaleSourceScanner' it's the default value.

@Postremus Postremus self-assigned this Dec 2, 2023
@Postremus
Copy link
Contributor

Hi @neo7BF,
sorry for the late response.

I am not able to reproduce this issue yet.

Here is my sample project.
Simply run mvn clean process-sources to execute the plugin.
The .jasper should be in target/compiled afterwards.

one-report.zip

Are you able to reproduce your issue with this sample project?

@Postremus
Copy link
Contributor

I figured something out. When the outputdirectory already contains an empty jasper file, it is not overwritten with new content.

@Postremus
Copy link
Contributor

Postremus commented Dec 20, 2023

Currently, the default is to use the org.codehaus.plexus.compiler.util.scan.StaleSourceScanner to check if a report needs to be recompiled. Only reports are compiled, where either the .jasper does not exists, or where the .jasper file is older then the source .jrxml file.

If, by any chance, any other process now modifies the compiled .jasper file, then it still exist and is newer then the source file.
So no recompilation is done here.

Another supported source scanner is the SimpleSourceInclusionScanner. This one just searches what source files exists, and always recompiles all of them.
You can use that one if it is a regular occurence in your workflow that compiled jasper files get modified.

<sourceScanner>org.codehaus.plexus.compiler.util.scan.SimpleSourceInclusionScanner</sourceScanner>

@Postremus
Copy link
Contributor

@neo7BF Can you confirm if my observations (see previous comment) are correct? Can you give any more details how this is happening for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants