【问题标题】:exclude in maven-jarsigner-plugin doesn't workmaven-jarsigner-plugin 中的排除不起作用
【发布时间】:2017-08-14 13:02:27
【问题描述】:

我已经在我的项目中配置了 jar signer 插件

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jarsigner-plugin</artifactId>
            <version>1.4</version>
            <executions>
                <execution>
                    <id>sign</id>
                    <goals>
                        <goal>sign</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <excludes>
                    <exclude>**/*-javadoc.jar</exclude>
                    <exclude>**/*-sources.jar</exclude>
                </excludes>
                <keystore>${project.basedir}\security\keystore.jks</keystore>
                <alias>mydomain</alias>
                <storepass>changeit</storepass>
                <keypass>changeit</keypass>
            </configuration>

因为我的项目还生成了一个不应签名的 javadoc 和一个源 jar,所以我尝试排除它。但它似乎不起作用。如果我查看我的 jar 文件,则已签名。此外,如果我查看 maven 输出,我可以看到源代码和 javadoc jar 调用了 jar 签名者。

我可以看到,配置被 maven 消耗:

[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-jarsigner-plugin:1.4:sign' with basic configurator -->
[DEBUG]   (f) alias = mydomain
[DEBUG]   (f) arguments = []
[DEBUG]   (f) excludes = [**/*-javadoc.jar, **/*-sources.jar]

谁能告诉我排除部分有什么问题?

【问题讨论】:

  • @Downvoter 请解释
  • 为什么你的反对者没有解释为什么。对改善问题很有帮助
  • @Downvoter:再次感谢
  • Re“排除部分有什么问题?”,可能是因为你没有指定archiveDirectory参数吗? excludes 参数的From the documentation“模式必须与参数 archiveDirectory 给出的目录相关。 excludeClassifiers 参数对您有用,因为它不关心 archiveDirectory

标签: maven jarsigner maven-jarsigner-plugin


【解决方案1】:

我建议使用excludeClassifiers

<excludeClassifiers>
  <excludeClassifier>javadoc</excludeClassifier>
  <excludeClassifier>sources</excludeClassifier>
</excludeClassifiers>

而不是你的排除。

此外,我建议不要在 Maven pom 中使用反斜杠。

【讨论】:

  • 它对我有用。非常感谢。但是为什么排除不起作用?
猜你喜欢
  • 1970-01-01
  • 2013-09-06
  • 2018-07-20
  • 1970-01-01
  • 1970-01-01
  • 2019-04-11
  • 1970-01-01
  • 1970-01-01
  • 2017-10-14
相关资源
最近更新 更多