0

我正在使用2.1.versions-maven-plugin

我有一个源代码树,如下所示:

+-- 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-templatecustoms-deployment-support. <parent />所有其他customs-*-template项目的base-parentpom.

注意:这customs-parentpom只是一个“聚合器”,并不是任何自定义模块的真正父级,但它确实在其部分中将每个customs-*项目声明为 a 。<module /><modules />

对于SNAPSHOT版本构建,这很好用。

现在,我想转到versioned每个工件的版本签名类似于x.x.x_yyyyMMddhhmm_nn.

所以,现在我想用versions-maven-plugin来构建customs-parentpom(或“聚合器” pom.xml

我使用 Jenkins 进行构建。因此,我配置了一个前置步骤来调整<parent />每个海关项目部分中的版本,例如:

mvn versions:update-parent

我希望它找到Nexus 中可用的最新上游工件(即base-parentpom和)。customs-parentpom

但它失败了......

[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考虑到我从不希望 Jenkins在上述情况下生成版本工件。我意识到 SNAPSHOT 在本地 .m2 存储库中不可用。我(真的)需要一个才能使版本插件正确解析吗?

我究竟做错了什么?甚至有可能做我想做的事吗?如果有帮助,我愿意分享 pom.xml 文件。

4

1 回答 1

0

所以这只是我的一个误解。如果您采用多模块设置,则需要确保在签出源代码时,为了构建模块,它必须能够将其路径追溯到parent(via <relativePath />)。

我正在检查一个模块,但不是它的父级;因此我得到了non-resolvable parent POM错误。

因此,为了让反应器发挥作用,您需要在聚合器(和/或父级)中定义所有模块pom.xml

然后你可以像这样构建一个(或多个)模块(项目)

mvn clean install --projects <project1>,<project2> --amd
于 2013-10-11T17:19:29.343 回答