25Aug/10Off
Building Obfuscated Signed Java Web Start Applications with Maven
I have Java Web Start application with several libraries, some of which I want to obfuscate before the release. Unfortunately, I cannot use Webstart Maven Plugin since it works correctly only when all the dependencies, which will be assembled, are already present in the repository. In my case, I want to obfuscate libraries on-the-fly, sign them, put into zip file and deploy to my repository.
Instead, I attach the following chain of plugins to maven build lifecycle:
- Download keystore (refer to my older post
- Download all dependencies (except ones, which I will obfuscate) with Maven Dependency Plugin
- Run ProGuard on needed jars with Maven ProGuard Plugin
- Sign all the jars with Maven Jarsigner Plugin
- Filter JNLP file with Maven Resources Plugin
- Assemble application with Maven Assembly Plugin
September 17th, 2010 - 05:09
Any chance of you sending me an example pom with all this in?
I am going crazy trying to get the webstart plugin running in a multimodule build
September 18th, 2010 - 12:49
Something like the following
<project>
…
<build>
<resources>
<resource>
<directory> [jnlp template dir] </directory>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>download-and-unpack-keystore</id>
<phase>package</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>dk.sorokin.maksim</groupId>
<artifactId>keystore</artifactId>
<version>1.0.0</version>
<outputDirectory>${project.build.directory}/keystore</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/bundle</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jarsigner-plugin</artifactId>
<executions>
<execution>
<id>sign</id>
<phase>package</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
<configuration>
<archiveDirectory>${project.build.directory}/bundle</archiveDirectory>
<keystore>${project.build.directory}/keystore/keystorefile</keystore>
<alias>Alias name</alias>
<storepass>Store password</storepass>
<keypass>Key password</keypass>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>filter-jnlp</id>
<phase>package</phase>
<goals>
<goal>resource</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>src/main/assembly/src.xml</descriptor> <!– where you specify details for assembly –>
</descriptors>
</configuration>
</plugin>
…