我在通过 pom.xml 将 .jrxml 编译为 .jasper 时遇到问题。在进行 mvn clean install、mvn -e compil、mvn eclipse:eclipse 后,我无法生成 .jasper。下面是我的 pom.xml。我确信我错过了一些东西,但不确定是什么。请帮忙..提前谢谢:) 网.SF.jasperreports 贾斯珀报告 4.8.0
<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.8.0</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
</profiles>
最佳答案
这是适合我的代码片段
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jasperreports-maven-plugin</artifactId>
<version>1.0-beta-2</version>
<configuration>
<sourceDirectory>src/main/webapp/WEB-INF/reports</sourceDirectory>
<outputDirectory>src/main/webapp/WEB-INF/reports</outputDirectory>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>compile-reports</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>3.5.3</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
</dependencies>
</plugin>
关于java - JaperReport maven Pom.xml 未创建.jasper 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14735367/