Reputation: 384
I want to release a module via Jenkins that uses a dependency which is not only distinguished by its version but also by a custom classifier passed as a system property at build time. The effective pom printed in the console output shows that the correct classifier is used
<dependency>
<groupId>de.test</groupId>
<artifactId>common-module</artifactId>
<version>0.0.4-SNAPSHOT</version>
<classifier>custom</classifier>
<scope>provided</scope>
</dependency>
However, when the release plugins' prepare goal runs, the build breaks due to a compilation error because of missing classes which are only available in the dependency version that uses the custom classifier. Printing the properties with the maven-antrun-plugin reveals that the release plugin is using the version without classifier.
[INFO] [echoproperties] de.test\:common-module\:jar=/var/lib/****/.m2/repository/de/test/common-module/0.0.4-SNAPSHOT/common-module-0.0.4-SNAPSHOT.jar
[INFO] [echoproperties] maven.dependency.de.test.common-module.jar.path=/var/lib/****/.m2/repository/de/test/common-module/0.0.4-SNAPSHOT/common-module-0.0.4-SNAPSHOT.jar
I would expect the release plugin to pickup the jar named common-module-0.0.4-SNAPSHOT-custom.jar
which is definitely available in the maven repository. Doesn't the release plugin support classifiers?
Upvotes: 0
Views: 620
Reputation: 384
Problem solved. I found out that there are two issues. First, the module was also part of a transitive dependency, so maven tried to download a version without classifier that doesn't exist prior to the version containing the classifier. Second, the classifier was not passed to the maven release plugin. To pass system variables to the plugin one has to use the arguments
option, so the actual command should be clean install -Darguments="-Dmy-classifier=custom" -Dmy-classifier=custom -B release:prepare release:perform
. The system variable declaration must be redundant, one for the pom dependency and another for the release plugin.
Upvotes: 0