2013-02-10 117 views
3

我有一個關於jenkins構建的問題。由於標題描述它是一個「不可解析的父POM for找不到神器和'parent.relativePath'指向錯誤的本地POM」問題,經常在stackoverflow上找到,但我還沒有找到匹配的問題。因此,這裏是我的問題描述jenkins - 無法解析的父POM無法找到神器和'parent.relativePath'點在錯誤的本地POM

我的項目結構如下:

/root-project 
+-----------/pom.xml 
/root-project/modul-a/ 
+-------------------/pom.xml 
/root-project/modul-b/ 
+-------------------/pom.xml 
/root-project/modul-c/ 
+-------------------/pom.xml 

在我的本地機器(窗口)我可以建立我的項目/有:

mvn -f root-project/pom.xml clean install 

沒有錯誤的,即使是一個空的存儲庫。

但jenkins(linux)無法做到這一點。

Gestartet durch Benutzer anonymous 
Building in workspace /opt/jenkins/jobs/Project/workspace 
Checkout:workspace//opt/jenkins/jobs/Project/workspace - [email protected] 
Using strategy: Default 
Last Built Revision: Revision acb4c7d9efd81c1c7d5bbd2f6e190d1cb0a5e359 (origin/HEAD, origin/master) 
Fetching changes from 1 remote Git repository 
Fetching upstream changes from http://repository.git 
Seen branch in repository origin/HEAD 
Seen branch in repository origin/master 
Seen branch in repository origin/version_branch 
Commencing build of Revision acb4c7d9efd81c1c7d5bbd2f6e190d1cb0a5e359 (origin/HEAD, origin/master) 
Checking out Revision acb4c7d9efd81c1c7d5bbd2f6e190d1cb0a5e359 (origin/HEAD, origin/master) 
Warning : There are multiple branch changesets here 
[workspace] $ /opt/apache-maven-3.0.4/bin/mvn -f root-project/pom.xml -e clean install javadoc:aggregate 
[INFO] Error stacktraces are turned on. 
[INFO] Scanning for projects... 
[ERROR] The build could not read 8 projects -> [Help 1] 
org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs: 
[FATAL] Non-resolvable parent POM: Could not find artifact org.example:rootartifact:pom:1.3.0-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 3, column 10 
[FATAL] Non-resolvable parent POM: Could not find artifact org.example:rootartifact:pom:1.3.0-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 5, column 11 
//... 
at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:363) 
at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:636) 
at org.apache.maven.DefaultMaven.getProjectsForMavenReactor(DefaultMaven.java:585) 
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:234) 
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) 
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537) 
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) 
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141) 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
at java.lang.reflect.Method.invoke(Method.java:601) 
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290) 
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230) 
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409) 
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352) 
[ERROR] 
[ERROR] The project org.example:module-a:1.3.0-SNAPSHOT (/opt/jenkins/jobs/Project/workspace/root-project/module-a/pom.xml) has 1 error 
[ERROR]  Non-resolvable parent POM: Could not find artifact org.example:root-project:pom:1.3.0-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 3, column 10 -> [Help 2] 
org.apache.maven.model.resolution.UnresolvableModelException: Could not find artifact org.example:root-project:pom:1.3.0-SNAPSHOT 

那麼這裏就是在我父POM

<?xml version="1.0" encoding="UTF-8"?> 
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 
<modelVersion>4.0.0</modelVersion> 
<groupId>org.example</groupId> 
<artifactId>root-project</artifactId> 
<version>1.3.0-SNAPSHOT</version> 
<packaging>pom</packaging> 
<modules> 
    <module>module-a</module> 
    <module>module-b</module> 

和模塊POM的一個例子

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 
    <parent> 
    <artifactId>root-project</artifactId> 
    <groupId>org.example</groupId> 
    <version>1.3.0-SNAPSHOT</version> 
    </parent> 
    <artifactId>module-a</artifactId> 
    <dependencies> 
    //.. 
    </dependencies> 
</project> 

正如我已經嘗試過其他項提及,但它沒有改變結果。爲什麼它應該指向存儲庫,父母從未去過。 那麼有人有一個建議,我做錯了什麼?

如這裏問是的MVN幫助輸出:有效-POM:

[INFO] Scanning for projects... 
[ERROR] The build could not read 3 projects -> [Help 1] 
[ERROR] 
[ERROR] The project org.example:modul-a:1.3.0-SNAPSHOT (/tmp/project/project-root/modul-a/pom.xml) has 1 error 
[ERROR]  Non-resolvable parent POM: Could not find artifact org.example:project:pom:1.3.0-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 3, column 10 -> [Help 2] 
[ERROR] 
[ERROR] The project org.example:modul-b:1.3.0-SNAPSHOT (/tmp/project/project-root/modul-b/pom.xml) has 1 error 
[ERROR]  Non-resolvable parent POM: Could not find artifact org.example:project:pom:1.3.0-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 5, column 11 -> [Help 2] 
[ERROR] 
[ERROR] The project org.example:modul-c:1.3.0-SNAPSHOT (/tmp/project/project-root/modul-c/pom.xml) has 1 error 
[ERROR]  Non-resolvable parent POM: Could not find artifact org.example:project:pom:1.3.0-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 6, column 10 -> [Help 2] 
[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 
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException 

回答

9

<artifactId>爲你的父母在你的例子模塊POM是root-project

您父母的pom中的<artifactId>prject。在詹金斯輸出中,似乎該工件的名稱正在解析爲rootproject。嘗試設置父母的pom <artifactId>root-project(注意額外的' - ')。

我不確定這是如何構建在您的機器上的。您可以在運行jenkins的計算機和機器上發佈運行mvn help:effective-pom的輸出嗎?

值得一提的是,您可以啓用調試輸出的-X標誌來查看Maven可能試圖採取的操作。我發現這在調試我的Maven項目的配置時很有用。

+0

第一:對不起,這是我匿名化的錯。父模塊的和模塊中對的引用都是ident。我會糾正它,並添加幫助:effective-pom輸出。這是相同的 - 並讓我瘋狂。今天,一個新的結帳不會建立在窗戶上... – Thomas 2013-02-11 18:14:05

+0

哦,你是如此接近 - 發現了一個從看不見的承諾的其他錯字... thx – Thomas 2013-02-11 21:57:46

+0

你是最受歡迎的。 – eric 2013-02-12 04:25:23

相關問題