jasper-reports Compile JasperReports .jrxml to .jasper With Apache Maven


Example

The JasperReports-plugin by Alex Nederlof is a good alternative of abandoned org.codehaus.mojo:jasperreports-maven-plugin plugin.

The adding of plugin is a typical, simple procedure:

<build>
    <plugins>
        <plugin>
            <groupId>com.alexnederlof</groupId>
            <artifactId>jasperreports-plugin</artifactId>
            <version>2.3</version>
            <executions>
                <execution>
                    <phase>process-sources</phase>
                    <goals>
                        <goal>jasper</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <sourceDirectory>src/main/resources/jrxml</sourceDirectory>
                <outputDirectory>${project.build.directory}/jasper</outputDirectory>
            </configuration>
        </plugin>
    </plugins>
</build>

The command for compilation with Maven:

mvn jasperreports:jasper

The jasper files will be created in ${project.build.directory}/jasper folder (for example, in /target/jasper)