We have a utility library that has improved over the time. Now there is this idea to also deploy this library to another repository. However, due to some constraints there we need to change the groupId
during that (the content of the JAR shouldn't change).
The current pom.xml
looks like this:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.sjngm.common</groupId>
<artifactId>common-lib</artifactId>
<version>1.0.5-SNAPSHOT</version>
<packaging>jar</packaging>
<distributionManagement>
<repository>
<id>ta</id>
<url>http://archiva.local/archiva/repository/ta/</url>
</repository>
<snapshotRepository>
<id>archiva.snapshots</id>
<url>http://archiva.local/archiva/repository/snapshots/</url>
</snapshotRepository>
</distributionManagement>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>1.5.4.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- plenty of that -->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<!-- ... -->
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<!-- ... -->
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<!-- ... -->
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<!-- ... -->
</plugin>
</plugins>
</build>
</project>
The new groupId
could be something like com.sjngmaway.common
.
I noticed relocation, but I don't understand how I can use it for my task:
- That seems to be a one-time thing, but we'll use this in parallel.
- Can I put this in the same
pom.xml
? With profiles or something? At least the<distributionManagement>
is different. - If that should be another
pom.xml
should I add a<dependency>
there? Or can I refer to or import my currentpom.xml
?
Or is this all just misleading and I need some other approach?
How do I proceed?
Since I'm not the Maven-genius it would be nice if you could use my snippet from above rather than just explain it in words what I can do :) Thanks!