在使用MAVEN来配置项目时,要用到JasperReports,可以在POM中加入链接。
POM dependencies片段:
- <dependency>
- <groupId>jasperreports</groupId>
- <artifactId>jasperreports</artifactId>
- <version>3.1.2</version>
- </dependency>
但是想在项目编译时,要将指定目录的*.jrxml进行编译的话需要加入Build插件。
POM build plugins片段:
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>jasperreports-maven-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>compile-reports</goal>
- </goals>
- </execution>
- </executions>
- <dependencies>
- <!–
- note this must be repeated here to pick up correct xml validation
- –>
- <dependency>
- <groupId>jasperreports</groupId>
- <artifactId>jasperreports</artifactId>
- <version>3.1.2</version>
- </dependency>
- </dependencies>
- </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. |
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.