Jresearch Software Blog

Update of Zelix obfuscation plugin.

Mar 16, 2009 by Stanislav Spiridonov

(Restored record from backup) 

Not long ago I spent a few hours (heh...) to improve the Zelix obfuscation plugin for Maven.

In our Flexess project we use the Zelix obfuscation for almost all modules. But there are some modules, which have to be unobfuscated and in addition be compiled against the obfuscated jars, e.g. Examples for our API.

Without obfuscation such (Example, in our case) modules contains the following dependency:

        <dependency>
<groupId>com.jresearchsoft.uam.client</groupId>
<artifactId>com.jresearchsoft.uam.client</artifactId>
<version>1.0.0-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>

It is Ok for development, but then I did an obfuscated build I needed to change manually all such dependencies (e.g. before assembly:assembly) to something like:

        <dependency>
<groupId>com.jresearchsoft.uam.client</groupId>
<artifactId>com.jresearchsoft.uam.client</artifactId>
<version>1.0.0-obfuscate-20071123101115</version>
<scope>runtime</scope>
</dependency>

To resolve this issue I introduced the resolve goal. This goal just scans the project during the build and tries to resolve all SNAPSHOT dependencies to obfuscated version. So the project will compiled against obfuscated versions of dependencies and the installed (deployed) artifact will have the resolved pom. To archive it you should add to the <build> section of a pom.xml the following code:

      <plugin>
<groupId>org.jresearch.commons.obfuscate</groupId>
<artifactId>org.jresearch.commons.obfuscate.plugin</artifactId>
<executions>
<execution>
<id>resolve</id>
<goals>
<goal>resolve</goal>
</goals>
</execution>
</executions>
</plugin>

Such definition will enable resolving. It has also one more side-effect - it will disable the obfuscation of a module. So if you have the multi-module project you can add to the root pom.xml the obfuscation directive and it will be automatically skipped in all modules with resolving.



Post a Comment:
Comments are closed for this entry.
 
corner-header-left-top corner-header-right-top

« March 2010
SunMonTueWedThuFriSat
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
   
       
Today


Links


Feeds


Navigation

 
© 2008-2009 Jresearch Software s.r.o.