May 19, 2009

Development JAR signing in Maven

For development purposes we needed to use a signed JAR in our project. First we created a keystore:

$ keytool -genkey -alias applet -keyalg RSA -keystore src/main/keystore/signing-jar.keystore -storepass applet -keypass applet -dname "CN=domain"

We can than use the following Maven POM file definition:


If we run mvn package we get a signed JAR file. Of course this is only useful for development purposes. To disable the JAR signing we invoke mvn package -Dmaven.jar.sign.skip=true