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