简体   繁体   English

Jasper Reports with Maven - 如何指定要编译的Java版本?

[英]Jasper Reports w/ Maven - How do I specify Java version to compile with?

Is there any way I can specify which version of Java to use when compiling my .jrxml files with Jasper Reports in Maven (using jasperreports-maven-plugin)? 有没有什么办法可以指定在使用Maven中的Jasper Reports编译我的.jrxml文件时使用哪个版本的Java(使用jasperreports-maven-plugin)? I saw this blog post saying claiming that Jasper uses the " default virtual machine set in your computer " and not "same version of the maven-compiler-plugin". 我看到这篇博文说声称Jasper使用“ 计算机中的默认虚拟机 ”,而不是“maven-compiler-plugin的相同版本”。 If I cannot change or guarantee the JAVA_HOME environment variable, how can I get Jasper to compile with Java6 ? 如果我无法更改或保证JAVA_HOME环境变量,我怎样才能让Jasper用Java6编译

Here is a snippet from my pom.xml: 这是我的pom.xml中的一个片段:

<plugins>
    <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>jasperreports-maven-plugin</artifactId>
        <version>1.0-beta-2</version>
        <configuration>
            <outputDirectory>${project.build.directory}/classes</outputDirectory>
        </configuration>
        <executions>
            <execution>
                <phase>compile</phase>
                <goals>
                    <goal>compile-reports</goal>
                </goals>
            </execution>
        </executions>
        <dependencies>
            <dependency>
                <groupId>net.sf.jasperreports</groupId>
                <artifactId>jasperreports</artifactId>
                <version>5.0.1</version>
            </dependency>
        </dependencies>
    </plugin>
    <plugin>
</plugins>

Looking on the Codehaus docs , there is a parameter you can use, but it doesn't say how to specify which Java version. 查看Codehaus文档 ,您可以使用一个参数,但它没有说明如何指定哪个Java版本。

Thanks! 谢谢!

According to this issue the folllowing parameters can help you: 根据这个问题 ,以下参数可以帮助您:

<configuration>
  ...
  <maven.compiler.source>1.6</maven.compiler.source>
  <maven.compiler.target>1.6</maven.compiler.target>
  <compiler>net.sf.jasperreports.engine.design.JRJdtCompiler</compiler>
  ...
</configuration>

1.0-beta-2, however, does not have these properties, so the later version is necessary. 但是,1.0-beta-2没有这些属性,因此需要更高版本。 You can either use a snapshot plugin version from here , of build a plugin from source code yourself. 你可以从这里使用快照插件版本,自己从源代码构建一个插件。 As far as I can see, plugin code from trunk supports these parameters. 据我所知, trunk的插件代码支持这些参数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM