6
將時間戳添加到我們的jar中會導致我們的maven構建比平常長4倍。時間戳是發佈版本所必需的,但我們不需要它來進行快照構建。我們如何將POM文件配置爲只在發佈版本時添加TSA參數(即,SNAPSHOT未出現在項目版本中)。如何在maven-jarsigner-plugin中的發行版中僅配置TSA參數
下面是我們的jsigner插件的POM條目。注意底部添加的參數。我們希望這些不被添加如果快照在項目中出現的版本:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<id>sign webcontent jars</id>
<phase>prepare-package</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
<configuration>
<archiveDirectory>${project.build.directory}/projectname-webcontent/applets</archiveDirectory>
<includes>
<include>*.jar</include>
</includes>
<keystore>Keystore</keystore>
<alias>alias</alias>
<storepass>pass</storepass>
<arguments>
<argument>-tsa</argument>
<argument>https://timestamp.geotrust.com/tsa</argument>
</arguments>
</configuration>
</plugin>