Search code examples
javamavenmanifestmaven-shade-plugin

How to add DefaultImplementationEntries to MANIFEST when using maven-shade-plugin?


Found this question about adding a version to manifest.mf: How do I add an Implementation-Version value to a jar manifest using Maven?, but how to add them when using shade plugin?

I tried with the maven-shade-plugin:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <executions>
        <execution>
            <goals>
                <goal>shade</goal>
            </goals>
            <configuration>
                <finalName>ispf-win</finalName>
                <shadedArtifactAttached>shade</shadedArtifactAttached>
                <outputDirectory>${project.build.directory}/ispf-win</outputDirectory>
                <transformers>
                    <transformer
                        implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                        <mainClass>desktop.win.main.Main</mainClass>
                        <manifest>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                        </manifest>
                    </transformer>
                </transformers>
            </configuration>
        </execution>
    </executions>
</plugin>

However, that generated an error:

Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:3.2.4:shade (default) on project desktop.win:
Unable to parse configuration of mojo org.apache.maven.plugins:maven-shade-plugin:3.2.4:shade for parameter addDefaultImplementationEntries: 
Cannot find 'addDefaultImplementationEntries' in class java.util.jar.Manifest

Solution

  • I think you should maybe rather be using <manifestEntries> See this example: THIS