项目部署至Jenkins之后出现报错:git无法下载github中的工程
错误提示如下:Started by user adminRunning as SYSTEMBuilding remotely on TestEnv in workspace /root/.jenkins/workspace/DeployOrderNo credentials specifiedCloning the remote Git repositoryCloning reposi...
错误提示如下:
Started by user admin
Running as SYSTEM
Building remotely on TestEnv in workspace /root/.jenkins/workspace/DeployOrder
No credentials specified
Cloning the remote Git repository
Cloning repository https://github.com/fushaoleigithub/order.git
> git.exe init /root/.jenkins/workspace/DeployOrder/order # timeout=10
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Could not init /root/.jenkins/workspace/DeployOrder/order
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:918)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:710)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:153)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:146)
at hudson.remoting.UserRequest.perform(UserRequest.java:211)
at hudson.remoting.UserRequest.perform(UserRequest.java:54)
at hudson.remoting.Request$2.run(Request.java:369)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Suppressed: hudson.remoting.Channel$CallSiteStackTrace: Remote call to TestEnv
at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1741)
at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:356)
at hudson.remoting.Channel.call(Channel.java:955)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:146)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:132)
at com.sun.proxy.$Proxy88.execute(Unknown Source)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1152)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1192)
at hudson.scm.SCM.checkout(SCM.java:504)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1206)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:574)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:499)
at hudson.model.Run.execute(Run.java:1838)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Caused by: hudson.plugins.git.GitException: Error performing command: git.exe init /root/.jenkins/workspace/DeployOrder/order
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2181)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2142)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2138)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1743)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:916)
... 11 more
Caused by: java.io.IOException: Cannot run program "git.exe" (in directory "/root/.jenkins/workspace/DeployOrder/order"): error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at hudson.Proc$LocalProc.<init>(Proc.java:250)
at hudson.Proc$LocalProc.<init>(Proc.java:219)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:937)
at hudson.Launcher$ProcStarter.start(Launcher.java:455)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2170)
... 15 more
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)
at java.lang.ProcessImpl.start(ProcessImpl.java:134)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 20 more
ERROR: Error cloning remote repo 'origin'
Finished: FAILURE
解决方案如下:
这是因为我们的Jenkins无法找到Linux下面的git地址
所以我们可以跳转至:https://blog.csdn.net/weixin_40816738/article/details/90405943
再跳转至:https://blog.csdn.net/weixin_40816738/article/details/90280863
只要我们照做就没问题了,就可以跑成功。
运行结果如下:
Started by user admin Running as SYSTEM Building remotely on TestEnv in workspace /root/.jenkins/workspace/DeployOrder No credentials specified > /usr/bin/git rev-parse --is-inside-work-tree # timeout=10 Fetching changes from the remote Git repository > /usr/bin/git config remote.origin.url https://github.com/fushaoleigithub/order.git # timeout=10 Fetching upstream changes from https://github.com/fushaoleigithub/order.git > /usr/bin/git --version # timeout=10 > /usr/bin/git fetch --tags --progress https://github.com/fushaoleigithub/order.git +refs/heads/*:refs/remotes/origin/* > /usr/bin/git rev-parse refs/remotes/origin/master^{commit} # timeout=10 > /usr/bin/git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10 Checking out Revision bb0d000656713b2df13176560a6d68bb3af20cf7 (refs/remotes/origin/master) > /usr/bin/git config core.sparsecheckout # timeout=10 > /usr/bin/git checkout -f bb0d000656713b2df13176560a6d68bb3af20cf7 Commit message: "update mysql configuration" > /usr/bin/git rev-list --no-walk bb0d000656713b2df13176560a6d68bb3af20cf7 # timeout=10 [DeployOrder] $ /bin/sh -xe /tmp/jenkins7751961190263031517.sh + BUILD_ID=DONTKILLME + . /etc/profile ++ '[' -x /usr/bin/id ']' ++ '[' -z 0 ']' +++ /usr/bin/id -un ++ USER=root ++ LOGNAME=root ++ MAIL=/var/spool/mail/root ++ '[' 0 = 0 ']' ++ pathmunge /usr/sbin ++ case ":${PATH}:" in ++ pathmunge /usr/local/sbin ++ case ":${PATH}:" in +++ /usr/bin/hostname ++ HOSTNAME=localhost.localdomain ++ HISTSIZE=1000 ++ '[' '' = ignorespace ']' ++ export HISTCONTROL=ignoredups ++ HISTCONTROL=ignoredups ++ export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL ++ '[' 0 -gt 199 ']' ++ umask 022 ++ for i in '/etc/profile.d/*.sh' ++ '[' -r /etc/profile.d/256term.sh ']' ++ '[' ehxB '!=' ehxB ']' ++ . /etc/profile.d/256term.sh +++ local256= +++ '[' -n '' ']' +++ '[' -n '' ']' +++ unset local256 ++ for i in '/etc/profile.d/*.sh' ++ '[' -r /etc/profile.d/bash_completion.sh ']' ++ '[' ehxB '!=' ehxB ']' ++ . /etc/profile.d/bash_completion.sh +++ '[' -z '4.2.46(1)-release' -o -z '' -o -n '' ']' +++ return ++ for i in '/etc/profile.d/*.sh' ++ '[' -r /etc/profile.d/colorgrep.sh ']' ++ '[' ehxB '!=' ehxB ']' ++ . /etc/profile.d/colorgrep.sh +++ /usr/libexec/grepconf.sh -c +++ alias 'grep=grep --color=auto' +++ alias 'egrep=egrep --color=auto' +++ alias 'fgrep=fgrep --color=auto' ++ for i in '/etc/profile.d/*.sh' ++ '[' -r /etc/profile.d/colorls.sh ']' ++ '[' ehxB '!=' ehxB ']' ++ . /etc/profile.d/colorls.sh +++ '[' '!' -t 0 ']' +++ return ++ for i in '/etc/profile.d/*.sh' ++ '[' -r /etc/profile.d/gnome-ssh-askpass.sh ']' ++ '[' ehxB '!=' ehxB ']' ++ . /etc/profile.d/gnome-ssh-askpass.sh +++ SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass +++ export SSH_ASKPASS ++ for i in '/etc/profile.d/*.sh' ++ '[' -r /etc/profile.d/lang.sh ']' ++ '[' ehxB '!=' ehxB ']' ++ . /etc/profile.d/lang.sh +++ sourced=0 +++ '[' -n en_US.UTF-8 ']' +++ saved_lang=en_US.UTF-8 +++ '[' -f /root/.i18n ']' +++ LANG=en_US.UTF-8 +++ unset saved_lang +++ '[' 0 = 1 ']' +++ unset sourced +++ unset langfile ++ for i in '/etc/profile.d/*.sh' ++ '[' -r /etc/profile.d/less.sh ']' ++ '[' ehxB '!=' ehxB ']' ++ . /etc/profile.d/less.sh +++ '[' -x /usr/bin/lesspipe.sh ']' +++ export 'LESSOPEN=||/usr/bin/lesspipe.sh %s' +++ LESSOPEN='||/usr/bin/lesspipe.sh %s' ++ for i in '/etc/profile.d/*.sh' ++ '[' -r /etc/profile.d/vim.sh ']' ++ '[' ehxB '!=' ehxB ']' ++ . /etc/profile.d/vim.sh +++ '[' -n '4.2.46(1)-release' -o -n '' -o -n '' ']' +++ '[' -x /usr/bin/id ']' ++++ /usr/bin/id -u +++ ID=0 +++ '[' -n 0 -a 0 -le 200 ']' +++ return ++ for i in '/etc/profile.d/*.sh' ++ '[' -r /etc/profile.d/which2.sh ']' ++ '[' ehxB '!=' ehxB ']' ++ . /etc/profile.d/which2.sh +++ alias 'which=alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde' ++ unset i ++ unset -f pathmunge ++ export MAVEN_HOME=/root/apache-maven-3.6.2 ++ MAVEN_HOME=/root/apache-maven-3.6.2 ++ export PATH=/root/apache-maven-3.6.2/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin ++ PATH=/root/apache-maven-3.6.2/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin ++ export PATH=/root/apache-maven-3.6.2/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/nginx/sbin ++ PATH=/root/apache-maven-3.6.2/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/nginx/sbin ++ JAVA_HOME=/usr/local/jdk1.8.0_111 ++ export PATH=/root/apache-maven-3.6.2/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/nginx/sbin:/usr/local/jdk1.8.0_111/bin ++ PATH=/root/apache-maven-3.6.2/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/nginx/sbin:/usr/local/jdk1.8.0_111/bin ++ export PATH=/root/apache-maven-3.6.2/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/nginx/sbin:/usr/local/jdk1.8.0_111/bin:/usr/local/node/bin ++ PATH=/root/apache-maven-3.6.2/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/nginx/sbin:/usr/local/jdk1.8.0_111/bin:/usr/local/node/bin ++ pwd + export PROJ_PATH=/root/.jenkins/workspace/DeployOrder + PROJ_PATH=/root/.jenkins/workspace/DeployOrder + export TOMCAT_APP_PATH=/root/apache-tomcat-9.0.27 + TOMCAT_APP_PATH=/root/apache-tomcat-9.0.27 + sh /root/.jenkins/workspace/DeployOrder/order/deploy.sh [INFO] Scanning for projects... [WARNING] [WARNING] Some problems were encountered while building the effective model for com.lesson:order:war:1.0 [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-war-plugin is missing. @ line 96, column 12 [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] --------------------------< com.lesson:order >-------------------------- [INFO] Building order 1.0 [INFO] --------------------------------[ war ]--------------------------------- [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ order --- [INFO] Deleting /root/.jenkins/workspace/DeployOrder/order/target [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ order --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 2 resources [INFO] [INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ order --- [INFO] Compiling 9 source files to /root/.jenkins/workspace/DeployOrder/order/target/classes [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.247 s [INFO] Finished at: 2019-10-22T03:35:34Z [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project order: Fatal error compiling: tools.jar not found: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.222.b10-1.el7_7.x86_64/jre/../lib/tools.jar -> [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/MojoExecutionException tomcat Id list :5663 cp: cannot stat ‘/root/.jenkins/workspace/DeployOrder/order/target/order.war’: No such file or directory mv: cannot stat ‘order.war’: No such file or directory Tomcat started. Finished: SUCCESS
更多推荐
所有评论(0)