Reputation: 1855
What's the easiest way to get the classifier name from Maven's properties and use it as a variable in the pom.xml
?
For example:
<properties>
<final_jar>${project.build.finalName}-${classifier}.jar</final_jar>
</properties>
There is no mention of a classifier property in the official documentation.
Looking at the source of maven-jar-plugin
, it seems that it's getting it from a property called maven.jar.classifier
but it doesn't seem to be available outside the plugin. Is there any way to access it ?
Upvotes: 7
Views: 1706
Reputation: 14772
Despite of classifier
being mentioned under POM Reference, Maven Coordinates it has to be declared in a maven-jar-plugin
section. So (you name it) it's not part of the <project>
element's Model
.
Unfortunately, I too haven't found a way yet to access the maven.jar.classifier
property of the maven-jar-plugin
but by declaring an extra <project>
property:
<project>
...
<properties>
<jar.classifier>CLASSIFIER</jar.classifier>
</properties>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<configuration>
<classifier>${jar.classifier}</classifier>
</configuration>
</plugin>
...
</project>
There's a Properties properties
in the Maven Model's
superclass ModelBase
. But if it's not used by a plugin...
And there's also no property interpolation syntax (yet?) like:
${project.build.plugins.plugin[<G>:<A>:<V>].<property>}
Upvotes: 1