詹金斯与git集成中的问题

时间:2019-07-04 06:22:07

标签: jenkins path continuous-integration

我在c:\program files(x86)\jenkins中安装了jenkins,并试图与helloworld java文件集成。但是当我第一次尝试从詹金斯本身构建时,它失败了。

我通过以下链接:https://www.youtube.com/watch?v=bGqS0f4Utn4 当我在admin cmd提示符下编译Java文件时,其编译成功。但在jenkins console内失败。 我创建了一个C:\ workspace文件夹,并将Java文件保存在那里。

 怎么了?为什么控制台输出中的路径错误?

am在控制台输出中出现以下错误:

`Console Output

Started by user user1
 Running as SYSTEM
 [EnvInject] - Loading node environment variables.
Building in workspace C:\Program Files (x86)\Jenkins\workspace\
   HelloWorld
[HelloWorld] $ cmd /c call C:\Windows\TEMP\jenkins6223662388306682118.bat

 C:\Program Files (x86)\Jenkins\workspace\HelloWorld>cd C:\Workspace 

    C:\Workspace>javac Hello.java 
      'javac' is not recognized as an internal or external command,
      operable program or batch file.

 C:\Workspace>java Hello 
'java' is not recognized as an internal or external command,
operable program or batch file.
  C:\Workspace>exit 9009 
 Build step 'Execute Windows batch command' marked build as failure
 Finished: FAILURE

1 个答案:

答案 0 :(得分:0)

  • 首先,由于已安装JDK,请确保已添加系统级环境变量
  • 在Jenkins中设置JDK bin路径>管理jenkins>全局工具配置> jdk安装,然后尝试 大多数情况下,此选项将有助于解决