Skip to content


Maven 2 JasperReports Plugin配置

在使用MAVEN来配置项目时,要用到JasperReports,可以在POM中加入链接。

POM dependencies片段:
  1. <dependency>  
  2.   <groupId>jasperreports</groupId>  
  3.   <artifactId>jasperreports</artifactId>  
  4.   <version>3.1.2</version>  
  5. </dependency>  

但是想在项目编译时,要将指定目录的*.jrxml进行编译的话需要加入Build插件。

POM build plugins片段:
  1. <plugin>  
  2.                 <groupId>org.codehaus.mojo</groupId>  
  3.                 <artifactId>jasperreports-maven-plugin</artifactId>  
  4.                 <executions>  
  5.                     <execution>  
  6.                         <goals>  
  7.                             <goal>compile-reports</goal>  
  8.                         </goals>  
  9.                     </execution>  
  10.                 </executions>  
  11.   
  12.                 <dependencies>  
  13.                     <!– 
  14.                         note this must be repeated here to pick up correct xml validation 
  15.                     –>  
  16.                     <dependency>  
  17.                         <groupId>jasperreports</groupId>  
  18.                         <artifactId>jasperreports</artifactId>  
  19.                         <version>3.1.2</version>  
  20.                     </dependency>  
  21.                 </dependencies>  
  22.   
  23.             </plugin>  

使用:mvn jasperreports:compile-reports -Ddetail=true

附上JasperReport Plugins的命令参数说明。

Optional Parameters

Name Type Since Description
additionalClasspath String - Any additional classpath entry you might want to add to the JasperReports compiler. Not recommended for general use, plugin dependencies should be used instead.
additionalProperties Map 1.0-beta-2 Additional JRProperties
classpathElements List - (no description)
compiler String - Uses the Javac compiler by default. This is different from the original JasperReports ant task, which uses the JDT compiler by default.
Default value is: net.sf.jasperreports.engine.design.JRJavacCompiler.
javaDirectory File - This is where the generated java sources are stored.
keepJava boolean - Deprecated. There seems to be an issue with the compiler plugin so don’t expect this to work yet – the dependencies will have disappeared.
Default value is: false.
keepSerializedObject boolean - Deprecated. Not implemented
Default value is: true.
outputDirectory File - This is where the .jasper files are written.
outputFileExt String - The extension of the compiled report files. Creates files with a .jasper extension by default.
Default value is: .jasper.
project MavenProject - (no description)
sourceDirectory File - This is where the xml report design files should be.
Default value is: src/main/jasperreports.
sourceFileExt String - The extension of the source files to look for. Finds files with a .jrxml extension by default.
Default value is: .jrxml.
xmlValidation boolean - Wether the xml design files must be validated.
Default value is: true.
Tags: jasperReports, java, maven

相关文章

Posted in 程序.

Tagged with , , .


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

You must be logged in to post a comment.