I want to use the Maven release plugin to release my Eclipse plugins, but in the release:prepare step, I have to skip updating the version number of some of the plugins. This is because they are a modified version of a plugin other 3rd party plugins depend on.
What I have tried is explicitely seeting the versions to the existing ones:
mvn release:prepare -DreleaseVersion=1.1.99 -Dproject.rel.org.eclipse.linuxtools.docker.core:org.eclipse.linuxtools.docker.core=4.1.0 -Dproject.dev.org.eclipse.linuxtools.docker.core:org.eclipse.linuxtools.docker.core=4.1.0-SNAPSHOT
This did not work for me, the release plugin still tried to change the versions.
Next I tried to separate the plugins into profiles, and only call release:prepare for the ones I wanted changed:
pom.xml
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>com.conti.daisy.bundles</artifactId>
<packaging>pom</packaging>
<parent>
<groupId>com.conti.daisy</groupId>
<artifactId>com.conti.daisy.build.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>./com.conti.daisy.build.parent</relativePath>
</parent>
<profiles>
<profile>
<id>daisy</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<modules>
...
</modules>
</profile>
<profile>
<id>linuxtools</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<modules>
<module>org.eclipse.linuxtools.docker.core</module>
</modules>
</profile>
command
mvn install -P !daisy # make sure I have the linuxtools plugins in the local repo
mvn release:prepare -P !linuxtools -DreleaseVersion=1.1.99
This has the drawback that the references to the parent pom are not updated in the skipped plugins, and that again makes the build break for me.
How is this properly handled?
What I did in the end, and what worked:
Before I run mvn release:prepare
, I run mvn install
to make sure all plugins are in the local repo.
Then I exclude the linuxtools
module by deactivating the linuxtools profile during release:prepare
, but I added the following goals to preparationGoals
and completionGoals
:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<id>update-parent-version</id>
<goals>
<goal>exec</goal>
</goals>
<phase>none</phase>
<configuration>
<executable>mvn</executable>
<workingDirectory>${rootlocation}</workingDirectory>
<arguments>
<argument>versions:update-child-modules</argument>
<argument>-N</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>install</id>
<goals>
<goal>exec</goal>
</goals>
<phase>none</phase>
<configuration>
<executable>mvn</executable>
<arguments>
<argument>install</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
This makes sure the linuxtools parent pom gets updated to the new version, and installs the new versions to the local repo.