代码之家  ›  专栏  ›  技术社区  ›  Carla

无法构建内置的Jenkins管道

  •  0
  • Carla  · 技术社区  · 6 年前

    我试图构建我的第一条管道,并以内置的Git管道为例:

    node {
       def mvnHome
       stage('Preparation') { // for display purposes
          // Get some code from a GitHub repository
          git 'https://github.com/jglick/simple-maven-project-with-tests.git'
          // Get the Maven tool.
          // ** NOTE: This 'M3' Maven tool must be configured
          // **       in the global configuration.           
          mvnHome = tool 'M3'
    
       }
       stage('Build') {
    
          // Run the maven build
          if (isUnix()) {
             sh "'${mvnHome}/bin/mvn' -Dmaven.test.failure.ignore clean package"
          } else {
             bat(/"${mvnHome}\bin\mvn" -Dmaven.test.failure.ignore clean package/)
          }
       }
       stage('Results') {
          junit '**/target/surefire-reports/TEST-*.xml'
          archive 'target/*.jar'
       }
    }
    

    Started by user unknown or anonymous
    Running in Durability level: MAX_SURVIVABILITY
    [Pipeline] node
    Running on Jenkins in /home/user01/.jenkins/workspace/mypipeline
    [Pipeline] {
    [Pipeline] stage
    [Pipeline] { (Preparation)
    [Pipeline] tool
    [Pipeline] }
    [Pipeline] // stage
    [Pipeline] stage
    [Pipeline] { (Build)
    [Pipeline] isUnix
    [Pipeline] sh
    [mypipeline] Running shell script
    + /home/user01/apache/apache-maven-3.5.3/bin/mvn -Dmaven.test.failure.ignore clean package
    [INFO] Scanning for projects...
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 0.092 s
    [INFO] Finished at: 2018-06-25T19:13:53+02:00
    [INFO] ------------------------------------------------------------------------
    [ERROR] The goal you specified requires a project to execute but there is no POM in this directory (/home/user01/.jenkins/workspace/mypipeline). 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
    [Pipeline] }
    [Pipeline] // stage
    [Pipeline] }
    [Pipeline] // node
    [Pipeline] End of Pipeline
    ERROR: script returned exit code 1
    

    我遵循的步骤是Jenkins wiki中描述的步骤,即:

    • 配置JDK路径
    • 配置Git路径

    如果我试图:

    ls /home/user01/.jenkins/workspace/mypipeline
    

    0 回复  |  直到 6 年前