[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default

问题出错环境

jenkins拉取gitlab上的代码进行clean install。
然后jenkins报错,查看控制台:

[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /var/jenkins_home/workspace/git-test/src/main/java/com/zyy/JenkinsGitlabTestApplication.java:[3,32] package org.springframework.boot does not exist
[ERROR] /var/jenkins_home/workspace/git-test/src/main/java/com/zyy/JenkinsGitlabTestApplication.java:[4,46] package org.springframework.boot.autoconfigure does not exist
[ERROR] /var/jenkins_home/workspace/git-test/src/main/java/com/zyy/JenkinsGitlabTestApplication.java:[6,2] cannot find symbol
  symbol: class SpringBootApplication
[ERROR] /var/jenkins_home/workspace/git-test/src/main/java/com/zyy/JenkinsGitlabTestApplication.java:[10,9] cannot find symbol
  symbol:   variable SpringApplication
  location: class com.zyy.JenkinsGitlabTestApplication
[INFO] 4 errors 
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:36 min
[INFO] Finished at: 2022-01-05T12:56:38Z
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project jenkins-gitlab-test: Compilation failure: Compilation failure:
[ERROR] /var/jenkins_home/workspace/git-test/src/main/java/com/zyy/JenkinsGitlabTestApplication.java:[3,32] package org.springframework.boot does not exist
[ERROR] /var/jenkins_home/workspace/git-test/src/main/java/com/zyy/JenkinsGitlabTestApplication.java:[4,46] package org.springframework.boot.autoconfigure does not exist
[ERROR] /var/jenkins_home/workspace/git-test/src/main/java/com/zyy/JenkinsGitlabTestApplication.java:[6,2] cannot find symbol
[ERROR] symbol: class SpringBootApplication
[ERROR] /var/jenkins_home/workspace/git-test/src/main/java/com/zyy/JenkinsGitlabTestApplication.java:[10,9] cannot find symbol
[ERROR] symbol:   variable SpringApplication
[ERROR] location: class com.zyy.JenkinsGitlabTestApplication
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project jenkins-gitlab-test: Compilation failure

解决过程

  1. 前一天晚上出现这个错误,没找到原因。试过更换jdk环境、maven插件版本号显式写出来。都没有起作用。
  2. 今天回来继续编译,还是相同的问题。按照/var/jenkins_home/workspace/git-test/src/main/java/com/zyy/JenkinsGitlabTestApplication.java查看jenkins容器中地址的正确性,没错。
  3. 然后返回到workspace文件夹时看到了一个D:的文件夹,很奇怪,点了进去,然后又有一个和我电脑上一模一样的文件夹!!到这里我懂了:)。。
  4. 我tm配置maven配置文件的时候是把电脑上setting.xml文件直接copy过来了,仓库地址是win上面的地址。我嘞个去。修改后再次编译成功。真的是亿亿点小细节呀

你可能感兴趣的:(Jenkins,Gitlab,Docker,maven,apache,jenkins,gitlab,java)