2013-10-07 32 views
0

我使用versions-maven-plugin的版本2.1如何使Maven版本插件更新父目標與多模塊項目一起工作

我有一個源代碼樹這樣的:

+-- JavaProjects 
    +-- customs-deployment-support 
     +-- pom.xml 
    +-- pom.xml  (a.k.a. base-parentpom) 
+-- Projects 
    +-- customs-template 
     +-- pom.xml 
    +-- customs-ear-template 
     +-- pom.xml 
    +-- customs-rpm-template 
     +-- pom.xml 
    +-- customs-site-template 
     +-- pom.xml 
    +-- pom.xml  (a.k.a. customs-parentpom) 

現在上述情況,<parent />customs-template項目customs-deployment-support。所有其他customs-*-template項目的<parent />base-parentpom

注:customs-parentpom只是一個「聚合器」,而不是任何海關模塊真正的父母,但它確實申報每個customs-*項目作爲其<modules />節一<module />

對於SNAPSHOT版本構建這個偉大的作品。

現在,我想移動到versioned工件,其中每個工件的版本簽名是類似於x.x.x_yyyyMMddhhmm_nn

所以,現在我想聘請versions-maven-plugin打造customs-parentpom(或「聚合器」 pom.xml

我用詹金斯構建。所以我配置的預步驟卷染各海關項目的<parent />部分中的版本,喜歡的東西:

mvn versions:update-parent 

我希望它找到最新的上游文物(即base-parentpomcustoms-parentpom)中的Nexus可用。

但它失敗...

[ERROR] The build could not read 4 projects -> [Help 1] 
[ERROR] 
[ERROR] The project com.etse:etse-customs-template:3.1.0-SNAPSHOT (/var/lib/jenkins/jobs/ETSE-trunk-AllCustoms/workspace/customs-template/pom.xml) has 1 error 
[ERROR]  Non-resolvable parent POM: Failure to find com.etse:etse-customs-deployment-support:pom:3.1.0-SNAPSHOT in http://repository.jboss.org/nexus/content/groups/public-jboss/ was cached in the local repository, resolution will not be reattempted until the update interval of jboss-public-repository-group has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM @ line 5, column 11 -> [Help 2] 
[ERROR] 
[ERROR] The project com.etse:etse-customs-ear-template:3.1.0-SNAPSHOT (/var/lib/jenkins/jobs/ETSE-trunk-AllCustoms/workspace/customs-ear-template/pom.xml) has 1 error 
[ERROR]  Non-resolvable parent POM: Failure to find com.etse:etse-parentpom:pom:3.1.0-SNAPSHOT in http://repository.jboss.org/nexus/content/groups/public-jboss/ was cached in the local repository, resolution will not be reattempted until the update interval of jboss-public-repository-group has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM @ line 5, column 10 -> [Help 2] 
[ERROR] 
[ERROR] The project com.etse:etse-customs-rpm-template:3.1.0-SNAPSHOT (/var/lib/jenkins/jobs/ETSE-trunk-AllCustoms/workspace/customs-rpm-template/pom.xml) has 1 error 
[ERROR]  Non-resolvable parent POM: Failure to find com.etse:etse-parentpom:pom:3.1.0-SNAPSHOT in http://repository.jboss.org/nexus/content/groups/public-jboss/ was cached in the local repository, resolution will not be reattempted until the update interval of jboss-public-repository-group has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM @ line 5, column 10 -> [Help 2] 
[ERROR] 
[ERROR] The project com.etse:etse-customs-site-template:3.1.0-SNAPSHOT (/var/lib/jenkins/jobs/ETSE-trunk-AllCustoms/workspace/customs-site-template/pom.xml) has 1 error 
[ERROR]  Non-resolvable parent POM: Failure to find com.etse:etse-parentpom:pom:3.1.0-SNAPSHOT in http://repository.jboss.org/nexus/content/groups/public-jboss/ was cached in the local repository, resolution will not be reattempted until the update interval of jboss-public-repository-group has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM @ line 5, 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 

考慮,我從來沒有想詹金斯以在上述情形SNAPSHOT版本神器。我意識到SNAPSHOT在本地.m2存儲庫中不可用。我真的需要一個版本插件才能正確解析嗎?

我在做什麼錯?甚至有可能做我想做的事情?如果有幫助,我願意共享pom.xml文件。

回答

0

所以這只是我的誤解而已。如果您使用多模塊設置,則需要確保在簽出源代碼時爲了構建模塊,必須能夠將其路徑追溯到parent(通過<relativePath />)。

我正在簽出一個模塊,但不是它的父類;因此我得到了non-resolvable parent POM錯誤。

因此,爲了讓反應堆盡其所能,您需要定義聚合器(和/或父代)pom.xml中的所有模塊。

然後你就可以建立一個(或多個)模塊(項目),像這樣

mvn clean install --projects <project1>,<project2> --amd 
+0

你是如何處理你在哪裏釋放項目的情況(例如:海關入耳式模板,讓我們假定它的父是JavaProjects中的一個項目)。假設當前的JavaProjects版本是0.0。4-SNAPSHOT和在custom-ear-template中你想獲得0.0.1版本,我不認爲使用版本:update-parent可以用於項目的0.0.1版本(因爲它會構建一個0.0.3的神器的海關耳模板比建立一個0.0.1版本的神器瓶/戰等文件)。 http://stackoverflow.com/questions/25918593/interesting-maven-questions-pom-types-and-how-to-handle-maven-parents-uncl –

相關問題