在Maven工作建立成功之后,Jenkins显示失败,未能解析POM

时间:2018-03-29 21:43:45

标签: maven jenkins

背景资料:

  1. 我在Mac上使用eclipse做了一个简单的maven项目,进行ui测试。

  2. 在localhost上设置jenkins服务器:8080(使用最新的jenkins版本)

  3. 将root POM配置为pom.xml在本地的位置(/Users/username/eclipse-workspace/ui-test/pom.xml)
  4. 可以使用maven local
  5. 成功构建
  6. 也在Jenkins上成功构建
  7. 然而,在jenkins显示出BUILD SUCCESS之后,它等待Jenkins完成收集数据"然后显示:

    "错误:无法解析POM java.nio.file.NoSuchFileException:/Users/username/.jenkins/workspace/UI-Automation-Job/Users/username/eclipse-workspace/ui-test/pom.xml"

    我感谢你的帮助。谢谢。

    ---detailed jenkins log---
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 43.119 s
    [INFO] Finished at: 2018-03-29T17:19:40-04:00
    [INFO] ------------------------------------------------------------------------
    Waiting for Jenkins to finish collecting data
    [JENKINS] Archiving /Users/username/eclipse-workspace/ui-test/pom.xml to ui-test/ui-test/0.0.1-SNAPSHOT/ui-test-0.0.1-SNAPSHOT.pom
    [JENKINS] Archiving /Users/username/eclipse-workspace/ui-test/target/ui-test-0.0.1-SNAPSHOT.jar to ui-test/ui-test/0.0.1-SNAPSHOT/ui-test-0.0.1-SNAPSHOT.jar
    /Users/username/eclipse-workspace/ui-test/pom.xml is not inside /Users/username/.jenkins/workspace/UI-Automation-Job/Users/username/eclipse-workspace/ui-test/; will archive in a separate pass
    /Users/username/eclipse-workspace/ui-test/target/ui-test-0.0.1-SNAPSHOT.jar is not inside /Users/username/.jenkins/workspace/UI-Automation-Job/Users/username/eclipse-workspace/ui-test/; will archive in a separate pass
    ERROR: Failed to parse POMs
    java.nio.file.NoSuchFileException: /Users/username/.jenkins/workspace/UI-Automation-Job/Users/username/eclipse-workspace/ui-test/pom.xml
        at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
        at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
        at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
        at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)
        at java.nio.file.Files.newByteChannel(Files.java:361)
        at java.nio.file.Files.newByteChannel(Files.java:407)
        at java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:384)
        at java.nio.file.Files.newInputStream(Files.java:152)
        at hudson.FilePath.read(FilePath.java:1849)
        at jenkins.plugins.maveninfo.extractor.properties.PomPropertiesFinder.findProperties(PomPropertiesFinder.java:50)
        at jenkins.plugins.maveninfo.extractor.MavenInfoExtractor.extract(MavenInfoExtractor.java:58)
        at jenkins.plugins.maveninfo.extractor.MavenInfoEnvironment.tearDown(MavenInfoEnvironment.java:42)
        at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:908)
        at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
        at hudson.model.Run.execute(Run.java:1727)
        at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543)
        at hudson.model.ResourceController.execute(ResourceController.java:97)
        at hudson.model.Executor.run(Executor.java:429)
    channel stopped
    ....
    ....
    

1 个答案:

答案 0 :(得分:0)

错误:

  

/Users/username/eclipse-workspace/ui-test/pom.xml不在里面   /Users/username/.jenkins/workspace/UI-Automation-Job/Users/username/eclipse-workspace/ui-test /;

我们可以学习Jenkins文件来找到你的pom.xml,请完成你的工作配置并找出你在哪里输入这个字符串/Users/username/eclipse-workspace/ui-test/pom.xml

检查以下大多数可能的地方:Root POMArchive files,建议使用相对路径,但绝对路径。

  詹金斯将在Jenkins Slave上创建一个文件夹(你可以在其上工作   执行)放置项目源代码,生成期间生成的东西   工作等等。

如果您使用相对路径,Jenkins将自动使用Job的工作区文件夹作为父文件夹。

enter image description here

enter image description here

相关问题