Java 为什么maven总是指向JRE的较低版本

Java 为什么maven总是指向JRE的较低版本,java,eclipse,maven,jenkins,Java,Eclipse,Maven,Jenkins,我有一个maven项目,其中我的驱动程序脚本是testng test,当我使用testng套件运行测试时,它工作得非常好 但是,当我使用pom.xml或jenkins运行测试时,它总是抱怨说它指向较低版本,尽管我在Eclipse中将JRE和编译器配置为最新版本 如何克服这个问题: 以下是詹金斯日志: Started by user anonymous Building in workspace C:\Users\Uday\.jenkins\workspace\MavenProj FSSCM.ch

我有一个maven项目,其中我的驱动程序脚本是testng test,当我使用testng套件运行测试时,它工作得非常好

但是,当我使用pom.xml或jenkins运行测试时,它总是抱怨说它指向较低版本,尽管我在Eclipse中将JRE和编译器配置为最新版本

如何克服这个问题:

以下是詹金斯日志:

Started by user anonymous
Building in workspace C:\Users\Uday\.jenkins\workspace\MavenProj
FSSCM.checkout D:\FrameworkDemos\MavenHAF to C:\Users\Uday\.jenkins\workspace\MavenProj
FSSCM.check completed in 62 milliseconds
Parsing POMs
Discovered a new module MavenWebHAF:MavenWebHAF MavenWebHAF
Modules changed, recalculating dependency graph
[MavenProj] $ "C:\Program Files\Java\jdk1.8.0_60/bin/java" -cp C:\Users\Uday\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven31-agent-1.5.jar;E:\Softwares\apache-maven-3.3.3\boot\plexus-classworlds-2.5.2.jar;E:\Softwares\apache-maven-3.3.3/conf/logging jenkins.maven3.agent.Maven31Main E:\Softwares\apache-maven-3.3.3 C:\Users\Uday\.jenkins\war\WEB-INF\lib\remoting-2.52.jar C:\Users\Uday\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven31-interceptor-1.5.jar C:\Users\Uday\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven3-interceptor-commons-1.5.jar 52877
<===[JENKINS REMOTING CAPACITY]===>channel started

Executing Maven:  -B -f C:\Users\Uday\.jenkins\workspace\MavenProj\pom.xml test -Dtest=TestSuite.TestAutomationDriver

[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for MavenWebHAF:MavenWebHAF:jar:0.0.1-SNAPSHOT
[WARNING] 'dependencies.dependency.systemPath' for com.relevantcodes:extentreports:jar should use a variable instead of a hard-coded path E:\Programming Samples\Selenium Jars\extentreports_Updated.jar @ line 33, column 21
[WARNING] 'dependencies.dependency.systemPath' for org.monte:media:jar should use a variable instead of a hard-coded path E:\Programming Samples\Selenium Jars\MonteScreenRecorder.jar @ line 40, column 21
[WARNING] 'dependencies.dependency.systemPath' for com.sun:tools:jar should use a variable instead of a hard-coded path C:\Program Files\Java\jdk1.8.0_60\lib\tools.jar @ line 52, column 29
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building MavenWebHAF 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------

[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ MavenWebHAF ---

[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\Uday\.jenkins\workspace\MavenProj\src\main\resources

[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ MavenWebHAF ---

[INFO] No sources to compile
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ MavenWebHAF ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\Uday\.jenkins\workspace\MavenProj\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ MavenWebHAF ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 7 source files to C:\Users\Uday\.jenkins\workspace\MavenProj\target\test-classes

[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /C:/Users/Uday/.jenkins/workspace/MavenProj/src/test/java/FrameworkLibraries/FunctionLibraries/CommonFunctionLibrary.java:[244,39] strings in switch are not supported in -source 1.5
  (use -source 7 or higher to enable strings in switch)
[ERROR] /C:/Users/Uday/.jenkins/workspace/MavenProj/src/test/java/FrameworkLibraries/FunctionLibraries/CommonFunctionLibrary.java:[287,39] strings in switch are not supported in -source 1.5
  (use -source 7 or higher to enable strings in switch)
[INFO] 2 errors 
[INFO] -------------------------------------------------------------

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17.643 s
[INFO] Finished at: 2015-09-29T23:47:29+05:30
[INFO] Final Memory: 24M/273M
[INFO] ------------------------------------------------------------------------

Waiting for Jenkins to finish collecting data
[JENKINS] Archiving C:\Users\Uday\.jenkins\workspace\MavenProj\pom.xml to MavenWebHAF/MavenWebHAF/0.0.1-SNAPSHOT/MavenWebHAF-0.0.1-SNAPSHOT.pom
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (default-testCompile) on project MavenWebHAF: Compilation failure: Compilation failure:
[ERROR] /C:/Users/Uday/.jenkins/workspace/MavenProj/src/test/java/FrameworkLibraries/FunctionLibraries/CommonFunctionLibrary.java:[244,39] strings in switch are not supported in -source 1.5
[ERROR] (use -source 7 or higher to enable strings in switch)
[ERROR] /C:/Users/Uday/.jenkins/workspace/MavenProj/src/test/java/FrameworkLibraries/FunctionLibraries/CommonFunctionLibrary.java:[287,39] strings in switch are not supported in -source 1.5
[ERROR] (use -source 7 or higher to enable strings in switch)
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
channel stopped

Finished: FAILURE
由匿名用户启动
在工作区C中生成:\Users\Uday\.jenkins\workspace\MavenProj
FSSCM.checkout D:\frameworkemos\MavenHAF到C:\Users\Uday\.jenkins\workspace\MavenProj
FSSCM.check在62毫秒内完成
解析pom
发现一个新模块MavenWebHAF:MavenWebHAF MavenWebHAF
模块已更改,正在重新计算依赖关系图
[MavenProj]$“C:\Program Files\Java\jdk1.8.0\U 60/bin/Java”-cp C:\Users\Uday\.jenkins\plugins\maven plugin\WEB-INF\lib\maven31-agent-1.5.jar;E:\Softwares\apache-maven-3.3.3\boot\plexus-classworlds-2.5.2.jar;E:\Softwares\apache-maven-3.3.3/conf/logging jenkins.maven3.agent.Maven31Main E:\Softwares\apache-maven-3.3.3 C:\Users\Uday\.jenkins\war\WEB-INF\lib\remoting-2.52.jar C:\Users\Uday\.jenkins\plugin\maven插件\WEB-INF\lib\maven31-interceptor-1.5.jar C:\Users\Uday\.jenkins\plugins\WEB-INF\lib\maven3-interceptor-commons-1.5.jar
频道启动
正在执行Maven:-B-fc:\Users\Uday\.jenkins\workspace\MavenProj\pom.xml test-Dtest=TestSuite.TestAutomationDriver
[信息]正在扫描项目。。。
[警告]
[警告]为MavenWebHAF:MavenWebHAF:jar:0.0.1-SNAPSHOT构建有效模型时遇到一些问题
[警告]“dependencies.dependency.systemPath”用于com。相关代码:extentreports:jar应使用变量,而不是硬编码路径E:\Programming Samples\Selenium Jars\extentreports_Updated.jar@第33行第21列
[警告]'dependencies.dependency.systemPath'for org.monte:media:jar应使用变量,而不是硬编码路径E:\Programming Samples\Selenium Jars\MonteScreenRecorder.jar@line 40,第21列
[警告]'dependencies.dependency.systemPath'for com.sun:tools:jar应使用变量,而不是硬编码路径C:\Program Files\Java\jdk1.8.0\u 60\lib\tools.jar@52行第29列
[警告]
[警告]强烈建议修复这些问题,因为它们会威胁到构建的稳定性。
[警告]
[警告]出于这个原因,未来的Maven版本可能不再支持构建这种格式错误的项目。
[警告]
[信息]
[信息]------------------------------------------------------------------------
[信息]构建MavenWebHAF 0.0.1-SNAPSHOT
[信息]------------------------------------------------------------------------
[信息]
[信息]---maven资源插件:2.6:resources(默认资源)@MavenWebHAF---
[警告]使用平台编码(实际上是Cp1252)复制过滤后的资源,即构建依赖于平台!
[信息]跳过不存在的资源目录C:\Users\Uday\.jenkins\workspace\MavenProj\src\main\resources
[信息]
[信息]---maven编译器插件:3.1:compile(默认编译)@MavenWebHAF---
[信息]没有要编译的源
[信息]
[信息]---maven资源插件:2.6:testResources(默认testResources)@MavenWebHAF---
[警告]使用平台编码(实际上是Cp1252)复制过滤后的资源,即构建依赖于平台!
[信息]跳过不存在的资源目录C:\Users\Uday\.jenkins\workspace\MavenProj\src\test\resources
[信息]
[信息]---maven编译器插件:3.1:testCompile(默认testCompile)@MavenWebHAF---
[信息]检测到更改-重新编译模块!
[警告]尚未使用平台编码Cp1252设置文件编码,即生成依赖于平台!
[信息]将7个源文件编译为C:\Users\Uday\.jenkins\workspace\MavenProj\target\test classes
[信息]-------------------------------------------------------------
[错误]编译错误:
[信息]-------------------------------------------------------------
[错误]/C:/Users/Uday/.jenkins/workspace/MavenProj/src/test/java/FrameworkLibraries/FunctionLibraries/CommonFunctionLibrary.java:[244,39]在-source 1.5中不支持开关中的字符串
(使用-source 7或更高版本启用开关中的字符串)
[错误]/C:/Users/Uday/.jenkins/workspace/MavenProj/src/test/java/FrameworkLibraries/FunctionLibraries/CommonFunctionLibrary.java:[287,39]在-source 1.5中不支持交换机中的字符串
(使用-source 7或更高版本启用开关中的字符串)
[信息]2个错误
[信息]-------------------------------------------------------------
[信息]------------------------------------------------------------------------
[信息]生成失败
[信息]------------------------------------------------------------------------
[信息]总时间:17.643秒
[信息]完成时间:2015-09-29T23:47:29+05:30
[信息]最终内存:24M/273M
[信息]------------------------------------------------------------------------
等待Jenkins完成数据收集
[JENKINS]存档C:\Users\Uday\.JENKINS\workspace\MavenProj\pom.xml到MavenWebHAF/MavenWebHAF/0.0.1-SNAPSHOT/MavenWebHAF-0.0.1-SNAPSHOT.pom
[错误]未能在项目MavenWebHAF上执行目标org.apache.maven.plugins:maven编译器插件:3.1:testCompile(默认testCompile):编译失败:编译失败:
[错误]/C:/Users/Uday/.jenkins/workspace/MavenProj/src/test/java/FrameworkLibraries/FunctionLibraries/CommonFunctionLibrary.java:[244,39]在-source 1.5中不支持开关中的字符串
[错误](使用-source 7或更高版本在交换机中启用字符串)
[错误]/C:/Users/Uday/.jenkins/workspace/MavenProj/src/test/java/FrameworkLibraries/FunctionLibraries/CommonFunctionLibrary.java:[287,39]在-source 1.5中不支持交换机中的字符串
[错误](使用-source 7或更高版本在交换机中启用字符串)
[错误]->[帮助1]
[错误]
[错误]要查看错误的完整堆栈跟踪,请使用-e开关重新运行Maven。
[错误]Re
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.3</version>
    <configuration>
      <source>1.8</source>
      <target>1.8</target>
    </configuration>
</plugin>
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.1</version>
    <configuration>
        <source>1.7</source>
        <target>1.7</target>
        <encoding>UTF-8</encoding>
    </configuration>
</plugin>