首页 文章

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

提问于
浏览
0

背景资料:

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

  • 在localhost上设置jenkins服务器:8080(带最新的jenkins版本)

  • 将root POM配置为pom.xml在本地的位置(/Users/username/eclipse-workspace/ui-test/pom.xml)

  • 它可以在maven本地成功构建

  • 也在Jenkins上成功构建

然而,在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

    从错误:

    /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将在Jenkins Slave上创建一个文件夹(在其上执行作业)以放置项目源代码,在作业运行期间生成的内容等 .

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

    enter image description here

    enter image description here

相关问题