jasperreport-plugin

A Jasper compiler plugin

License

License

Categories

Categories

JasperReports Business Logic Libraries Reporting
GroupId

GroupId

com.alexnederlof
ArtifactId

ArtifactId

jasperreports-plugin
Last Version

Last Version

2.8
Release Date

Release Date

Type

Type

maven-plugin
Description

Description

jasperreport-plugin
A Jasper compiler plugin
Project URL

Project URL

http://github.com/alexnederlof/Jasper-report-maven-plugin
Source Code Management

Source Code Management

http://github.com/alexnederlof/Jasper-report-maven-plugin

Download jasperreports-plugin

How to add to project

<plugin>
    <groupId>com.alexnederlof</groupId>
    <artifactId>jasperreports-plugin</artifactId>
    <version>2.8</version>
</plugin>

Dependencies

compile (7)

Group / Artifact Type Version
net.sf.jasperreports : jasperreports jar 6.15.0
commons-lang : commons-lang jar 2.6
org.apache.maven : maven-plugin-api jar 3.6.3
net.sf.jasperreports : jasperreports-fonts jar 6.15.0
org.slf4j : slf4j-simple jar 1.7.30
org.codehaus.plexus : plexus-compiler-api jar 2.8.8
javax.servlet : javax.servlet-api jar 4.0.1

provided (1)

Group / Artifact Type Version
org.apache.maven.plugin-tools : maven-plugin-annotations jar 3.6.0

test (3)

Group / Artifact Type Version
junit : junit jar 4.13
org.apache.maven.shared : maven-plugin-testing-harness jar 1.1
org.codehaus.plexus : plexus-utils jar 3.3.0

Project Modules

There are no modules declared in this project.

JasperReports-plugin

This maven compiles Jasper files to the target directory.

👋 This plugin is up for adoption

I've not used this plugin myself in years, so I'd like to hand this project over to people who actually use it. If you are interested, please open an issue to reach me. - Alex

Motivation

The original jasperreports-maven-plugin from org.codehaus.mojo was a bit slow. This plugin is 10x faster. I tested it with 52 reports which took 48 seconds with the original plugin and only 4.7 seconds with this plugin.

Usage

You can use the plugin by adding it to the plug-in section in your pom;

<build>
	<plugins>
		<plugin>
			<groupId>com.alexnederlof</groupId>
			<artifactId>jasperreports-plugin</artifactId>
			<version>2.8</version>
			<executions>
				<execution>
					<phase>process-sources</phase>
	   				<goals>
	      					<goal>jasper</goal>
	   				</goals>
	   			</execution>
			</executions>
			<configuration>
				<!-- These are the default configurations: -->
				<compiler>net.sf.jasperreports.engine.design.JRJdtCompiler</compiler>
				<sourceDirectory>src/main/jasperreports</sourceDirectory>
				<outputDirectory>${project.build.directory}/jasper</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>
</build>

If you want to pass any Jasper options to the compiler you can do so by adding them to the configuration like so:

<plugin>
	...
	<configuration>
		...
		<additionalProperties>
			<net.sf.jasperreports.awt.ignore.missing.font>true</net.sf.jasperreports.awt.ignore.missing.font>
			<net.sf.jasperreports.default.pdf.font.name>Courier</net.sf.jasperreports.default.pdf.font.name>
			<net.sf.jasperreports.default.pdf.encoding>UTF-8</net.sf.jasperreports.default.pdf.encoding>
			<net.sf.jasperreports.default.pdf.embedded>true</net.sf.jasperreports.default.pdf.embedded>
           </additionalProperties>
	</configuration>
</plugin>

You can also add extra elements to the classpath using

<plugin>
	...
	<configuration>
		...
		<classpathElements>
			<element>your.classpath.element</element>
        </classpathElements>
	</configuration>
</plugin>

You can also use this alternative approach for JARs:

<plugin>
	...
	<configuration>
		...
		<additionalClasspath>/web/lib/ServiceBeans.jar;/web/lib/WebForms.jar</additionalClasspath>
	</configuration>
</plugin>

Versions

Version
2.8
2.7
2.6
2.5
2.4
2.3
2.2
2.1
2.0
1.9
1.8
1.7
1.6