ytW*_*Who 5 java keytool maven-plugin
我正在使用keytool-maven-plugin将 alias.cer 文件导入 java cacerts 存储,它工作正常。第二次构建项目时出现问题;收到错误,因为 alias.cer 文件已添加到存储中。我看不到任何参数来解决插件中的问题。有“skip”和“skipIfExist”参数。这些参数不是为了这个目的;skip禁用插件,如果商店已经存在,skipIfExist跳过。
我怎么能解决这个问题?或者你知道这个目标的替代插件吗?
我意识到这个插件是通过 java keytool 开发的。keytool 中没有任何参数用于“如果证书已存在则跳过”目的。因此,我通过添加在构建项目时使用的自定义参数,使用“skip”参数来处理此问题。
<properties>
<cert.skip>true</cert.skip>
</properties>
<plugin>
<!-- https://mvnrepository.com/artifact/org.codehaus.mojo/keytool-maven-plugin -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>keytool-maven-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<goals>
<goal>importCertificate</goal>
</goals>
<phase>generate-sources</phase>
</execution>
</executions>
<configuration>
<skip>${cert.skip}</skip>
<keystore>${JAVA_HOME}/lib/security/cacerts</keystore>
<storepass>changeit</storepass>
<alias>alias</alias>
<file>${basedir}/src/main/resources/alias.cer</file>
<noprompt>true</noprompt>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
用法: mvn clean install -Dcert.skip=false
| 归档时间: |
|
| 查看次数: |
185 次 |
| 最近记录: |