我一直在使用Jenkins和Maven来运行我的一些自动化作业,但最近我发现控制台日志在干净安装过程中一直显示相同的错误。我尝试在线更新JAVA_HOME和其他各种各样的东西,但没有一个工作。即使作业完成并通过构建也只是失败导致错误:
Executing Maven: -B -f D:\jenkins\workspace\DummyTesting\pom.xml clean install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building automation 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ automation ---
[INFO] Deleting D:\jenkins\workspace\DummyTesting\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ automation ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\jenkins\workspace \DummyTesting\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ automation ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ automation ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ automation ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 51 source files to D:\jenkins\workspace\DummyTesting\target\test-classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.679 s
[INFO] Finished at: 2016-11-22T15:17:57+08:00
[INFO] Final Memory: 9M/23M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (default-testCompile) on project automation: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[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
答案 0 :(得分:0)
看起来像詹金斯无法选择jdk。请检查您的JAVA_HOME是否已设置并指向JDK。
您还可以尝试从jenkins UI设置JAVA_HOME,如下所示:
Go To Jenkins -> Manage Jenkins -> Configure System -> JDK. Configure path to the JDK under JAVA_HOME field.
答案 1 :(得分:0)
至少有两个其他来源表明,对于远程代理,您需要在节点配置中为指向java.home
的环境变量 指向JAVA_HOME目录(不仅仅是{{1 }}或类似的内容。
导航至%JAVA_HOME%
,然后单击远程节点旁边的配置图标。在此处,向下滚动至“节点属性”,在Jenkins > Manage Jenkins > Manage Nodes
的复选框中打勾,并为名称定义Environment Variables
,并为值定义JDK的路径,例如java.home
这是我最终要做的,即使在构建代理服务器上发现所有系统环境变量都正确并且c:\Program Files\Java\jdk1.8.0_181
和java -version
都在正确报告之后。
我意识到OP没有指定“主控”或“远程”,但是希望这对偶然发现此问与答的人有所帮助。
此消息提供了第一个线索,但没有解释:https://www.pgs-soft.com/blog/oops-jenkins-slave-maven-not-working/
我无法追踪我在谷歌搜索时发现的关于此修复程序的其他提及。