使用maven-shade-plugin时如何将DefaultImplementationEntries添加到MANIFEST?
How to add DefaultImplementationEntries to MANIFEST when using maven-shade-plugin?
找到关于如何向 manifest.mf 添加版本的问题:How do I add an Implementation-Version value to a jar manifest using Maven?,但是如何在使用 shade 插件时添加它们?
我在我的 pom.xml 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>
但是我可能会报错:
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 addDefaultI
mplementationEntries: Cannot find 'addDefaultImplementationEntries' in class java.util.jar.Manifest
我认为您或许应该使用 <manifestEntries>
参见例如THIS
找到关于如何向 manifest.mf 添加版本的问题:How do I add an Implementation-Version value to a jar manifest using Maven?,但是如何在使用 shade 插件时添加它们?
我在我的 pom.xml 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>
但是我可能会报错:
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 addDefaultI
mplementationEntries: Cannot find 'addDefaultImplementationEntries' in class java.util.jar.Manifest
我认为您或许应该使用 <manifestEntries>
参见例如THIS