Suppose you have a need for two versions of an artifact: for openjpa and for eclipselink - say because jar contains entities that are needed to be enhanced JPA implementation specifically.
You might have some different handling for these builds defined in Maven profiles and the profiles used then have also property <classifier/>.
To build a specific classified version, the maven-jar-plugin in the pom would then be configured like so:
<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: openjpa and eclipselink, would result to files in repo 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 it would be only matter of classifier to which one use, so for OpenJPA, for example:
<dependency>
<groupId>org.example</groupId>
<artifactId>data</artifactId>
<version>1.0.0</version>
<classifier>openjpa</classifier>
</dependency>
and for EclipseLink you would switch classifier as:
<dependency>
<groupId>org.example</groupId>
<artifactId>data</artifactId>
<version>1.0.0</version>
<classifier>eclipselink</classifier>
</dependency>