Generate .jasper with maven plugin

11,779

Solution 1

I know this is old, but this happened to me when I defined the plugin in the <pluginManagement> section of the POM instead of in <plugins>.

Solution 2

This was the pom config I used

<build>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jasperreports-maven-plugin</artifactId>
            <version>1.0-beta-2</version>
            <executions>
                <execution>
                    <goals>
                        <goal>compile-reports</goal>
                    </goals>
                    <configuration>
                        <!--  jrxml file  directory-->
                        <sourceDirectory>src\\main\\resources\\reports\\template</sourceDirectory>
                        <sourceFileExt>.jrxml</sourceFileExt>
                        <compiler>net.sf.jasperreports.engine.design.JRJavacCompiler</compiler>
                        <!--  Destination for jasper file -->
                        <outputDirectory>src\\main\\resources\\reports\\jasper</outputDirectory>
                    </configuration>
                </execution>
            </executions>
            <dependencies>
                <!-- These plugins are used to specify correct version for jrxml xml validation -->
                <dependency>
                    <groupId>net.sf.jasperreports</groupId>
                    <artifactId>jasperreports</artifactId>
                    <version>4.5.0</version>
                </dependency>

                <dependency>
                    <groupId>log4j</groupId>
                    <artifactId>log4j</artifactId>
                    <version>1.2.16</version>
                </dependency>

            </dependencies>
        </plugin>

    </plugins>
</build>
Share:
11,779
Toni Rodriguez
Author by

Toni Rodriguez

Updated on November 26, 2022

Comments

  • Toni Rodriguez
    Toni Rodriguez over 1 year

    I´m looking to improve the performance of my application, which has two types of reports, and compile then at execution time like this :

      final JasperDesign design = JRXmlLoader.load(input);
    
      final JasperReport compiledReport = JasperCompileManager.compileReport(design);
    

    This code executes every time when the user wants to see the report on the app. To avoid this, I´m trying to execute the compilation of the .jrxml through maven jasperreports plugin, but it doesn't work, and there isn't an error on console. The .jasper files don't appear in my directory "outputDirectory".

            <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jasperreports-maven-plugin</artifactId>
            <executions>
             <execution>
                  <phase>compile</phase>
                <inherited>false</inherited>
                <goals>
                    <goal>compile-reports</goal>
                </goals>
             </execution>
            </executions>
            <configuration>
             <sourceDirectory>src/main/resources/reports</sourceDirectory>
            <outputDirectory>src/main/resources/reports/jasper</outputDirectory>
                <compiler>net.sf.jasperreports.engine.design.JRJdtCompiler</compiler>
            </configuration>
        </plugin>
    
    • Deendayal Garg
      Deendayal Garg almost 8 years
    • Toni Rodriguez
      Toni Rodriguez almost 8 years
      Thanks Deendayal. I follow this page, add the dependencies and exclusions. My app strarts up but the folder "jasper" is still empty... I dont find the problem..
    • Deendayal Garg
      Deendayal Garg almost 8 years
      and you are not getting any error in the build log?
    • Toni Rodriguez
      Toni Rodriguez almost 8 years
      No, any error.. the start up is correct.
    • Tunaki
      Tunaki almost 8 years
      Consider migrating to jasperreports-plugin instead: stackoverflow.com/q/18495377/1743880
    • Toni Rodriguez
      Toni Rodriguez almost 8 years
      try with jasperreports-plugin, the folder jasper continues empty.. Its very extrange