How to setup multi-module maven project with proper release and version structure
I could not find the best practice for my multi-module maven project,in terms of versioning, release and osgi bundles,
First of all Versioning and relase. my project has 5-6 sub modules with 200+ jar so wanted to use aggregation,
Case 1: Not to specify project versions and use parent version
in this case if i use maven release plugin both tagging and pom.next is ok for development (ok means jar3 will always use latest version of jar1 which is same with itself)but what if i need to make patch relase only for jar1 ? how can i manage to make relase (it says Can't release project due to non released dependencies parent:0.0.2-SNAPSHOT) and if i manage to release jar1 0.0.1.1 ,how to say jar3 to use patched version of jar1?
Parent Proejct (0.0.1-Snapshot)
Module1 Jar1 Jar2 Module2 Jar3 (dependencies)[Jar1(project.version),Jar2(project.version)] Jar4 (dependencies)[Jar1(project.version),Jar3(project.version)]
Case 2: Maybe it is good idea to specify jar versions in property file of parent pom
in this case when use release plugin unfortunetly when i check pom.next i see that both jar version and dependency versions are reverted to hardcoded instead of property (jar1.version) so that for next release i will not be able to use properties , and second problem is even i manage to solve 1st problem maven release plugin does not change properties so next release will use unmodified vers开发者_JS百科ions from properties
Parent Proejct
Properties jar1.version jar2.version jar3.version jar4.version Module1 Jar1(jar1.version) Jar2(jar2.version) Module2(0.0.1-Snapshot) Jar3(jar3.version) (dependencies)[Jar1,Jar2] Jar4(0.0.1-Snapshot) (dependencies)[Jar1,Jar3]
I am kind of confused, didnt thought that relase and patch procedure would be that difficult, what is the best way to manage this kind of requirements with maven
finally i managed to support release(version) management for my multi-module project with //dependencyManagement\
My parent 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>
and my module 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>
and my module 2 pom that depends module 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>
精彩评论