[英]JaperReport maven Pom.xml Not creating.jasper file
I am having the issue in compiling .jrxml to .jasper through pom.xml. 我在通过pom.xml将.jrxml编译为.jasper时遇到了问题。 I am not able to generate .jasper after giving mvn clean install, mvn -e compile, mvn eclipse:eclipse.
在给出mvn clean install,mvn -e compile,mvn eclipse:eclipse之后,我无法生成.jasper。 Below is my pom.xml.
下面是我的pom.xml。 I am sure i am missing something but not sure what.
我确信我错过了一些东西,但不确定是什么。 please help..Thanks is advance :) net.sf.jasperreports jasperreports 4.8.0
请帮助..感谢提前:) net.sf.jasperreports 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>
Here is the snippet works for me 这段代码对我有用
<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>
I have .jasper created in src\\main\\jasper -----not is resource directly in src\\main. 我在src \\ main \\ jasper中创建了.jasper -----不是直接在src \\ main中的资源。 now i am not able to read in java code.
现在我无法读取java代码。 it always returns null.
它总是返回null。 PLEASE HELP.I have tried:
请帮助。我试过:
1) File file = new File(ReportConnection.class.getClassLoader().getResource("src/main/jasperreports/sample_Report.jasper").toString()); 1)文件文件=新文件(ReportConnection.class.getClassLoader()。getResource(“src / main / jasperreports / sample_Report.jasper”)。toString());
2)URL resource = ClassLoader.getSystemResource("src/main/jasperreports/sample_Report.jasper"); 2)URL资源= ClassLoader.getSystemResource(“src / main / jasperreports / sample_Report.jasper”);
3) FILE_BASE_FOLDER_ON_CLASSPATH = "src//main//jasperreports"; 3)FILE_BASE_FOLDER_ON_CLASSPATH =“src // main // jasperreports”; iStream = ReportConnection.class .getClassLoader() .getResourceAsStream( FILE_BASE_FOLDER_ON_CLASSPATH + "sample.jasper");
iStream = ReportConnection.class .getClassLoader()。getResourceAsStream(FILE_BASE_FOLDER_ON_CLASSPATH +“sample.jasper”);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.