最后,我设法通过 //dependencyManagement\ 支持我的多模块项目的发布(版本)管理
我的父母 pom
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.seyn</groupId>
<artifactId>hophop</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>hophop</name>
<scm>
<connection></connection>
<developerConnection></developerConnection>
<url></url>
</scm>
<properties>
<hophop1.version>0.0.1-SNAPSHOT</hophop1.version>
<hophop2.version>0.0.1-SNAPSHOT</hophop2.version>
</properties>
<modules>
<module>../hophop1</module>
<module>../hophop2</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.1</version>
</plugin>
</plugins>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.seyn</groupId>
<artifactId>hophop1</artifactId>
<version>${hophop1.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
和我的模块 1 pom:
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>hophop</artifactId>
<groupId>com.seyn</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>..\hophop</relativePath>
</parent>
<groupId>com.seyn</groupId>
<artifactId>hophop1</artifactId>
<version>0.0.1-SNAPSHOT</version>
<scm>
<connection>seyn</connection>
<developerConnection>seyn</developerConnection>
<url>seyn</url>
</scm>
</project>
我的模块 2 pom 依赖于模块 1:
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>hophop</artifactId>
<groupId>com.seyn</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>..\hophop</relativePath>
</parent>
<groupId>com.seyn</groupId>
<artifactId>hophop2</artifactId>
<version>0.0.1-SNAPSHOT</version>
<scm>
<connection>seyn</connection>
<developerConnection>seyn</developerConnection>
<url>seyn</url>
</scm>
<dependencies>
<dependency>
<groupId>com.seyn</groupId>
<artifactId>hophop1</artifactId>
</dependency>
</dependencies>
</project>