多模块发布报告SNAPSHOTS

时间:2015-10-30 19:09:05

标签: maven maven-release-plugin

我有一个多模块maven项目,我过去使用maven-release-plugin成功发布了该项目。当我尝试发布时,它会报告我的依赖项中仍然有快照。所有SNAPSHOTS都来自多模块父项目中的其他项目,我有autoVersionSubmodules = true。

Project
| pom.xml     // multimodule pom
|-BasePOM
| | pom.xml   // This is parent pom to all projects
|-Proj1
| | pom.xml
|-Proj2
| | pom.xml   // contains dependency to Proj1

唯一的版本信息在BasePOM / pom.xml中,以及每个项目poms中的引用。使用$ {project.version}

完成依赖关系版本控制

BasePOM / pom.xml的

<groupId>org.something</groupId>
<artifactId>BasePOM</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>

<!--other stuff -->

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-release-plugin</artifactId>
            <version>2.5.3</version>
            <configuration>
                <tagBase>${svn_root}/tags</tagBase>
                <autoVersionSubmodules>true</autoVersionSubmodules>
                <updateDependencies>true</updateDependencies>
                <useReleaseProfile>false</useReleaseProfile>
        </configuration>
        </plugin>
    </plugins>
</build>

项目/ pom.xml的

<parent>
    <groupId>org.something</groupId>
    <artifactId>BasePOM</artifactId>
    <version>1.0-SNAPSHOT</version>
    <relativePath>BasePOM/pom.xml</relativePath>
</parent>

<!--other stuff -->

<modules>
    <module>BasePOM</module>
    <module>Proj1</module>
    <module>Proj2</module>
</modules>

Proj1 / pom.xml的

<parent>
    <groupId>org.something</groupId>
    <artifactId>BasePOM</artifactId>
    <version>1.0-SNAPSHOT</version>
    <relativePath>../BasePOM/pom.xml</relativePath>
</parent>

<!--other stuff -->

Proj2 / pom.xml的

<parent>
    <groupId>org.something</groupId>
    <artifactId>BasePOM</artifactId>
    <version>1.0-SNAPSHOT</version>
    <relativePath>../BasePOM/pom.xml</relativePath>
</parent>

<!--other stuff -->

<dependencies>
    <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>Proj1</artifactId>
        <version>${project.version}</version>
    </dependency>
</dependencies>

关于为什么maven报告我有“剩余快照依赖”的任何想法?

2 个答案:

答案 0 :(得分:0)

BasePOM不是您的反应堆的模块,因此它不受autoVersionSubmodules = true的影响。

答案 1 :(得分:0)

I resolved the problem.

The above use of multi-module is good. My actual code had a dependency to an project that used to be in the code but was removed. That meant that the artifact was in the maven repository so my code built fine. It wasn't until I tried to do a release that the maven-release-plugin marked the errant SNAPSHOT as being unresolved. Because the deleted project had a similar name to other projects, I didn't realize it was a mistake when I was trying to diagnose this problem.

I spent a full day trying to figure out why the maven-release-plugin was not working like it used to. Note to self: pay special attention to what the error message actually says, not what you think the problem is.