Spring Boot Sping Boot Microservices - Jenkinsfile“您指定的目标需要一个项目来执行,但此目录中没有POM”

hiz5n14c  于 2023-01-30  发布在  Spring
关注(0)|答案(1)|浏览(129)

在Jenkins中为我的Spring Boot微服务示例运行Jenkinsfile时遇到了一个问题。
我负责Jenkins和多克的案子。
在我的SpringBootMicroservices示例中实现了Jenkins所需的设置并创建了Jenkinsfile之后,我在Jenkins中运行了管道,但是得到了一个错误。

这是下面显示的错误消息。

+ mvn clean install -D skipTests
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.053 s
[INFO] Finished at: 2023-01-29T01:07:58Z
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (/var/jenkins_home/workspace/Spring Boot Microservices Pipeline). Please verify you invoked Maven from the correct directory. -> [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/MissingProjectException

如何解决此问题?
编辑。
我在定义mvn -f springbootmicroservicedailybuffer clean install -DskipTests时遇到了这个问题

+ mvn -f springbootmicroservicedailybuffer clean install -DskipTests
POM file springbootmicroservicedailybuffer specified with the -f/--file command line argument does not exist
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-readable POM /var/jenkins_home/workspace/Spring Boot Microservices Pipeline/springbootmicroservicedailybuffer: /var/jenkins_home/workspace/Spring Boot Microservices Pipeline/springbootmicroservicedailybuffer (No such file or directory) @ 
 @ 
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   
[ERROR]   The project  (/var/jenkins_home/workspace/Spring Boot Microservices Pipeline/springbootmicroservicedailybuffer) has 1 error
[ERROR]     Non-readable POM /var/jenkins_home/workspace/Spring Boot Microservices Pipeline/springbootmicroservicedailybuffer: /var/jenkins_home/workspace/Spring Boot Microservices Pipeline/springbootmicroservicedailybuffer (No such file or directory)
[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/ProjectBuildingException

当我定义cd springbootmicroservicedailybuffer时,我遇到了这个问题。

+ cd springbootmicroservicedailybuffer
/var/jenkins_home/workspace/Spring Boot Microservices Pipeline@tmp/durable-d244520a/script.sh: 1: cd: can't cd to springbootmicroservicedailybuffer

下面是我的回购:Link
下面是git后端系统:Link

k3bvogb1

k3bvogb11#

在您的存储库(https://github.com/Rapter1990/springbootmicroservicedailybuffer)中,您有几个pom.xml,但是它们位于子文件夹中,因此您应该在运行maven之前输入它们。

dir("apigateway") {
  sh "mvn clean install -DskipTests"
}
dir("auth-service") {
  sh "mvn clean install -DskipTests"
}
...

我想您可以删除Jenkinsfile中的“git”行,因为Jenkins已经下载了项目来运行它(您的Jenkinsfile和源代码在同一个git repo中)

相关问题