Signing jars with maven
To sign jars with maven one should make use of the maven-jarsigner-plugin which
in turn uses the jarsigner tool of the jdk to do its job. Place the following
snippet in the base pom:
<profiles>
...
<profile>
<id>sign</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>sign</goal>
</goals>
<phase>package</phase>
<configuration>
<keystore>src/keystore/signing-jar.keystore</keystore>
<alias>signed</alias>
<archiveDirectory>modules</archiveDirectory>
<includes>
<include>**/target/matterhorn-*.jar</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
...
</profiles>
To sign the jars issue "mvn -Psign".
As a prerequisite you need a keystore file under
$MH/src/keystore/signing-jar.keystore with a signature aliased "signed". An
example keystore can be generated with the following shell script. The
parameter "dname" needs to be adjusted accordingly.
#!/bin/sh
KEYSTORE=src/keystore/signing-jar.keystore
ALIAS=signed
STOREPASS=opencast
KEYPASS=opencast
keytool -genkey -alias $ALIAS -keystore $KEYSTORE -storepass $STOREPASS
-keypass $KEYPASS -dname "CN=developer, OU=Opencast, O=org.opencastproject,
L=Somewhere, ST=Germany, C=DE"
keytool -selfcert -alias $ALIAS -keystore $KEYSTORE -storepass $STOREPASS
-keypass $KEYPASS
Without being the "sign" profile active by default, you need to issue the
following command sequence in order to produce and install signed jars:
$ mvn package
$ mvn -Psign -Djarsigner.keypass=PASSWORD -Djarsigner.storepass=PASSWORD
$ mvn -Dmaven.test.skip=true install
Useful links:
http://download.oracle.com/javase/1.5.0/docs/tooldocs/solaris/jarsigner.html
http://maven.apache.org/plugins/maven-jarsigner-plugin/
http://stackoverflow.com/questions/2027753/how-to-deploy-applet-with-dependencies-jar-using-maven-and-sign-it
Hope that helps,
Christoph
Am 11.08.2011 um 19:44 schrieb Christopher Brooks:
> Hi all,
>
> Someone (Christoph?) was going to look into how to sign jars with mvn;
> anyone end up doing that? As we get closer to the release of 1.2 I'd
> like to get the process cemented down so that the wiki is clear for
> future release managers. And ideally, I'd like to use the mvn method
> of signing jars.
>
> Any help here from people who know mvn better?
>
> Chris
>
> --
> Christopher Brooks, BSc, MSc
> ARIES Laboratory, University of Saskatchewan
>
> Web: http://www.cs.usask.ca/~cab938
> Phone: 1.306.966.1442
> Mail: Advanced Research in Intelligent Educational Systems Laboratory
> Department of Computer Science
> University of Saskatchewan
> 176 Thorvaldson Building
> 110 Science Place
> Saskatoon, SK
> S7N 5C9
> _______________________________________________
> Matterhorn mailing list
> [email protected]
> http://lists.opencastproject.org/mailman/listinfo/matterhorn
>
>
> To unsubscribe please email
> [email protected]
> _______________________________________________
_______________________________________________
Matterhorn mailing list
[email protected]
http://lists.opencastproject.org/mailman/listinfo/matterhorn
To unsubscribe please email
[email protected]
_______________________________________________