如何在使用maven shade插件时将defaultimplementationentries添加到清单中?

kse8i1jr  于 2021-08-20  发布在  Java
关注(0)|答案(1)|浏览(372)

找到了关于如何将版本添加到manifest.mf的问题:如何使用maven?将实现版本值添加到jar清单,但如何在使用shade插件时添加它们?
我在pom.xml maven shade插件中尝试的内容:

<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
kknvjkwl

kknvjkwl1#

我想你应该使用 <manifestEntries> 参见例如本节

相关问题