How to add Class-Path to manifest file with maven

When using maven-jar-plugin
I would like to add an entry to Manifest.mf
Thus, it will contain:
Class path :.
When I add this entry to Pom:

<Class-Path>.</Class-Path> 

It will create a Class-Path with all the dependency.
as:
Class path :. jar1name.jar jar2name.jar etc.
Instead of just
Class path :.
Is there a way to prevent maven from adding all jar names to Class-Path?
thanks

  <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <configuration> <archive> <manifest> <addClasspath>true</addClasspath> </manifest> <manifestEntries> <Built-By>Me</Built-By> <Class-Path>.</Class-Path> </manifestEntries> </archive> </configuration> </plugin> 
+7
java maven manifest
source share
1 answer

It did the trick
Omit addClass path and add manifestEntries
Now log4j.properties could be outside the jar - and still be found ...

  <manifest> <addClasspath>true</addClasspath> </manifest> 

It works:

  <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <configuration> <archive> <manifestEntries> <Built-By>Me</Built-By> <Class-Path>.</Class-Path> </manifestEntries> </archive> </configuration> </plugin> 

Output:

  Manifest-Version: 1.0 Archiver-Version: Plexus Archiver Created-By: Apache Maven Build-Jdk: 1.6.0_45 Built-By: Me Class-Path: . 
+17
source share

All Articles