Another more pragmatic example answer is to better understand the usefulness of classifier .
Suppose you need two versions of an artifact: for openjpa and for eclipselink - let's say because the jar contains objects that are needed for a particular JPA implementation.
You may have some different processing for these assemblies defined in Maven profiles, and the profiles used also have the <classifier /> property.
To build different classified versions, the pom maven-jar-plugin will then be configured as follows
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>3.0.2</version> <configuration> <classifier>${classifier}</classifier> </configuration> </plugin>
Installing both will cause the files in the repo to look something like this:
org / example / data / 1.0.0 / data 1.0.0.pom
org / example / data / 1.0.0 / data 1.0.0-openjpa.jar
org / example / data / 1.0.0 / data-1.0.0-eclipselink.jar
Now there will only be a classifier question to be used, therefore
<dependency> <groupId>org.example</groupId> <artifactId>data</artifactId> <version>1.0.0</version> <classifier>[openjpa|eclipselink]</classifier> </dependency>
pirho Dec 09 '17 at 21:32 2017-12-09 21:32
source share