There is a maven project with two modules.

One contains some code and is built in jar.

<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/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>my.group</groupId> <artifactId>full-project</artifactId> <version>0.0.1-SNAPSHOT</version> </parent> <artifactId>linkable</artifactId> </project> 

The second uses this jar as a dependency and builds it into a running jar.

 <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/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>my.group</groupId> <artifactId>full-project</artifactId> <version>0.0.1-SNAPSHOT</version> </parent> <artifactId>executable</artifactId> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <configuration> <archive> <manifest> <addClasspath>true</addClasspath> <useUniqueVersions>false</useUniqueVersions> <mainClass>executable.Main</mainClass> </manifest> </archive> </configuration> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>my.group</groupId> <artifactId>linkable</artifactId> <version>0.0.1-SNAPSHOT</version> </dependency> </dependencies> </project> 

But if to open the started jar, then in it there will be the following manifesto.

 Manifest-Version: 1.0 Archiver-Version: Plexus Archiver Built-By: ilsu87 Class-Path: linkable-0.0.1-SNAPSHOT.jar Created-By: Apache Maven 3.3.9 Build-Jdk: 1.8.0_111 Main-Class: executable.Main 

Apparently Class-Path points to the archive with the version. Either I do not understand something, or useUniqueVersions does not work as expected. And I expected the class-path to be linkable.jar

I build from Eclipse:

 Eclipse IDE for Java Developers Version: Neon.1a Release (4.6.1) Build id: 20161007-1200 

    1 answer 1

    From the Apache Maven Archiver documentation

    useUniqueVersions

    Snapshot versions rather than -SNAPSHOT versions. The default value is true.

    This option indicates whether to replace the word SNAPSHOT in the file name with a unique timestamp. For example, if true in my case, it could be something like linkable-0.0.1-20170129.145744-25.jar instead of linkable-0.0.1-SNAPSHOT.jar

    It seems that maven ignores this option and always uses SNAPSHOT.

    But my expectations were wrong. The version for any value appears in the Class-Path manifest. This was avoided only by setting the custom name format through other options.

     <classpathLayoutType>custom</classpathLayoutType> <customClasspathLayout>${artifact.artifactId}.${artifact.extension}</customClasspathLayout>