多模块发布报告快照
Multi-module release reporting SNAPSHOTS
我有一个多模块 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>
Project/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 报告我有 "remaining snapshot dependencies" 的任何想法?
BasePOM
不是您的反应器的模块,因此不受 autoVersionSubmodules = true
的影响。
我解决了这个问题。
上面多模块的使用还是不错的。我的实际代码依赖于一个曾经在代码中但已被删除的项目。这意味着该工件位于 Maven 存储库中,因此我的代码构建良好。直到我尝试发布时,maven-release-plugin 才将错误的 SNAPSHOT 标记为未解决。由于删除的项目与其他项目的名称相似,所以我在尝试诊断此问题时没有意识到这是一个错误。
我花了一整天的时间试图弄清楚为什么 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>
Project/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 报告我有 "remaining snapshot dependencies" 的任何想法?
BasePOM
不是您的反应器的模块,因此不受 autoVersionSubmodules = true
的影响。
我解决了这个问题。
上面多模块的使用还是不错的。我的实际代码依赖于一个曾经在代码中但已被删除的项目。这意味着该工件位于 Maven 存储库中,因此我的代码构建良好。直到我尝试发布时,maven-release-plugin 才将错误的 SNAPSHOT 标记为未解决。由于删除的项目与其他项目的名称相似,所以我在尝试诊断此问题时没有意识到这是一个错误。
我花了一整天的时间试图弄清楚为什么 maven-release-plugin 不像以前那样工作。自我注意:要特别注意错误信息的实际内容,而不是你认为的问题所在。