使用Maven Shade构建应用程序jar时,排除所有META-INF / versions目录/文件是否安全?

问题描述 投票:2回答:1

我相信版本文件夹在那里可以支持多个Java版本。我们始终为非常特定的版本(目前为11)构建。创建单个应用程序jar时,排除那些目录/文件是否存在危险?例如。>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.1</version>
<configuration>
    <transformers>
        <transformer
            implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
            <mainClass>${start-class}</mainClass>
            <manifestEntries>
                <Class-Path>./</Class-Path>
                <Implementation-Version>${ourSoftware.revision}</Implementation-Version>
            </manifestEntries>
        </transformer>
    </transformers>
    <filters>
        <filter>
            <artifact>*:*</artifact>

            <excludes>
                <exclude>META-INF/*.SF</exclude>
                <exclude>META-INF/*.DSA</exclude>
                <exclude>META-INF/*.RSA</exclude>

                <exclude>META-INF/versions/**</exclude> <!-- IS THIS SAFE? -->
            </excludes>
        </filter>
    </filters>
    <finalName>${project.artifactId}App</finalName>
</configuration>
<executions>
    <execution>
        <phase>package</phase>
        <goals>
            <goal>shade</goal>
        </goals>
    </execution>
</executions>

谢谢!

我相信版本文件夹在那里可以支持多个Java版本。我们始终为非常特定的版本(目前为11)构建。当...

java maven-shade-plugin
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.