Ata*_*hev 11 java maven jenkins
我有一台安装了JDK&JRE 6和7的Jenkins服务器.
所有项目都建立在1.6上,除了1.7依赖项目.
我已经将maven pom文件配置为使用JAVA_HOME_7环境PATH中的Java编译器.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
**<executable>${env.JAVA_HOME_7}/bin/javac</executable>**
<fork>true</fork>
<verbose>false</verbose>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
在mvn安装期间,我收到以下错误:
java.lang.RuntimeException: There was an error in the forked process
java.lang.UnsupportedClassVersionError: : Unsupported major.minor version 51.0
Run Code Online (Sandbox Code Playgroud)
我认为这意味着服务器正在使用JRE 1.6.
如何将JRE 1.6与1.7保持在一起以保持与旧1.6项目和新1.7项目的兼容性?
非常感谢,Atanas
sbk*_*sbk 12
您还需要使用java 7运行surefire测试.默认情况下,surefire将使用与运行maven相同的jvm - 在您的情况下为Java6.
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.13</version>
<configuration>
...
<jvm>${env.JAVA_HOME_7}/bin/java</jvm>
</configuration>
</plugin>
</plugins>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
12590 次 |
最近记录: |