如何在maven中添加原始父级的相对路径

时间:2015-05-07 12:20:13

标签: java maven jenkins pom.xml parent-pom

我在父pom中添加了一个来自开源社区的子模块。 它拥有自己的父母。 抛出以下内容:

  

[错误]无法读取Maven项目:为com.offbytwo.jenkins构建有效模型时遇到了2个问题:jenkins-client:0.2.1.302.1   [警告]' parent.relativePath'在com.verigreen点:verigreen-root而不是org.sonatype.oss:oss-parent,请验证你的项目结构@第18行,第10栏   [致命]不可解析的父POM:无法转移org.sonatype.oss:来自http://repo.maven.apache.org/maven2的oss-parent:pom:7被缓存在本地存储库中,在中心的更新间隔之前不会重新尝试解析已过去或更新被强制。原始错误:无法传输工件org.sonatype.oss:oss-parent:pom:7 from / to central(http://repo.maven.apache.org/maven2):连接超时到http://repo.maven.apache.org/maven2/org/sonatype/oss/oss-parent/7/oss-parent-7.pom和' parent.relativePath&# 39;指向错误的本地POM @第18行第10列    项目com.offbytwo.jenkins:jenkins-client:0.2.1.302.1 at C:\ Verigreen \ VG_test_branches \ jenkins-client \ pom.xml

我的父母pom看起来像那样:

<artifactId>verigreen-root</artifactId>
    <version>1.6.1-SNAPSHOT</version>
    <packaging>pom</packaging>
    <name>verigreen</name>
    .
    .
    <modules>
        <module>jenkins-client</module>
        <module>vg-common</module>

jenkins-client pom看起来像这样:

<name>Jenkins Client</name>
    <url>http://github.com/RisingOak/jenkins-client</url>
    <description>A Jenkins API client for Java</description>

    <groupId>com.offbytwo.jenkins</groupId>
    <artifactId>jenkins-client</artifactId>
    <version>0.2.1.302.1</version>
    <packaging>jar</packaging>

    <parent>
        <groupId>org.sonatype.oss</groupId>
        <artifactId>oss-parent</artifactId>
        <version>7</version>
    </parent>

我如何指向父pom?

1 个答案:

答案 0 :(得分:2)

您有父母的错误信息,请将其更改为:

<parent>
    <groupId>com.verigreen</groupId>
    <artifactId>verigreen-root</artifactId>
    <version>1.6.1-SNAPSHOT</version>
</parent>

并在父pom上添加(如果不存在):

<groupId>com.verigreen</groupId>