我正在使用多模块pom设置,当使用发布插件时,我无法这样做。 我收到错误:
Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5:prepare (default-cli) on project libraryparent: Can't release project due to non released dependencies :
com.xyz:libraryparent:pom:1.1-SNAPSHOT
in project 'utils' (com.xyz:utils:jar:1.1-SNAPSHOT)
我运行的命令是:
mvn -B release:clean release:prepare release:perform -DdryRun=true -DdevelopmentVersion=1.2-SNAPSHOT -DreleaseVersion=1.1
以下是我认为相关文件的主要部分:
<modelVersion>4.0.0</modelVersion>
<groupId>com.xyz</groupId>
<artifactId>libraryparent</artifactId>
<version>1.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>parent library</name>
<description>A parent pom for all library modules</description>
<modules>
<module>../util</module>
<module>../streams</module>
</modules>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.5</version>
<configuration>
<releaseProfiles>release</releaseProfiles>
<goals>deploy assembly:single</goals>
<!--
<autoVersionSubmodules>true</autoVersionSubmodules>
-->
</configuration>
</plugin>
<project .....>
<modelVersion>4.0.0</modelVersion>
<artifactId>util</artifactId>
<packaging>jar</packaging>
<parent>
<groupId>com.xyz</groupId>
<artifactId>libraryparent</artifactId>
<relativePath>../libraryparent/pom.xml</relativePath>
<version>1.1-SNAPSHOT</version>
</parent>
</project>
<project .....>
<modelVersion>4.0.0</modelVersion>
<artifactId>streams</artifactId>
<packaging>jar</packaging>
<parent>
<groupId>com.xyz</groupId>
<artifactId>libraryparent</artifactId>
<relativePath>../libraryparent/pom.xml</relativePath>
<version>1.1-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>com.xyz</groupId>
<artifactId>util</artifactId>
<version>1.1-SNAPSHOT</version>
<!--
<version>${project.parent.version}</version>
-->
<classifier>j2me</classifier>
<optional>true</optional>
</dependency>
</dependencies>
</project>
我怀疑发布插件可以将版本设置为发布版本等等。
感谢。
答案 0 :(得分:3)
maven-release-plugin
验证父项和依赖项是否是多模块项目的一部分。如果它未被识别,则可能是因为版本不同,也可能是因为groupId和/或artifactId中的拼写错误。 com.xyz
可能是假的,所以请再次检查该值。
有些人可能会说maven-release-plugin不支持平面项目(比如这个)。但是,有很多集成测试确实支持平面项目。
答案 1 :(得分:0)
我想我刚刚找到了解决方案,
我会做一个更完整的测试并很快发布结果。
从此更改maven-release-plugin目标:
<goals>deploy assembly:single</goals>
到这个
<goals>deploy</goals>
......结束......