How to add Class-Path to the manifest file with maven

This did the trick

Omitting the addClasspath and adding manifestEntries

Now, log4j.properties can reside outside the jar – and still be found…

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

This is working:

    <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: .

Leave a Comment