Working example maven obfuscate

I just want to confuse a simple maven java application. I am using maven-proguard-plugin. All main / java classes should be confusing. I try different configurations with no luck. Last thing:

    <build>
    <plugins>
        <plugin>
            <groupId>com.github.wvengen</groupId>
            <artifactId>proguard-maven-plugin</artifactId>
            <version>2.0.6</version>
            <dependencies>
                <dependency>
                    <groupId>net.sf.proguard</groupId>
                    <artifactId>proguard-base</artifactId>
                    <version>4.10</version>
                    <scope>runtime</scope>
                </dependency>
            </dependencies>
            <executions>
               <execution>
                   <phase>package</phase>
                   <goals><goal>proguard</goal></goals>
               </execution>
            </executions>
            <configuration>
                <proguardVersion>4.10</proguardVersion>
                <options>
                    <option>-keep class *{*;}</option>
                </options>
                <libs>
                    <lib>${java.home}/lib/rt.jar</lib>
                </libs>
            </configuration>
        </plugin>
    </plugins>
</build>

result - all classes exist in the target bank, but not obfuscation, jad decompiles it well. How to make obfuscation rights? I can’t understand - just obfuscate the whole source - a very unusual task? All other plugins work out of the box like a charm. Why should I introduce some weird options in this? I spent the whole day. I want the agreement to be implemented through the configuration! :)

+4
source share
2 answers

Maven :). , , , . , http://proguard.sourceforge.net/#manual/introduction.html, , . . , . , , . :

<build>
    <plugins>
        <plugin>
            <groupId>com.github.wvengen</groupId>
            <artifactId>proguard-maven-plugin</artifactId>
            <version>2.0.6</version>
            <dependencies>
                <dependency>
                    <groupId>net.sf.proguard</groupId>
                    <artifactId>proguard-base</artifactId>
                    <version>4.10</version>
                </dependency>
            </dependencies>
            <executions>
               <execution>
                   <phase>package</phase>
                   <goals><goal>proguard</goal></goals>
               </execution>
            </executions>
            <configuration>
                <proguardVersion>4.10</proguardVersion>
                <options>
                    <option>-keep public class myapp.Main{public static void main(java.lang.String[]);}</option>
                </options>
                <libs>
                    <lib>${java.home}/lib/rt.jar</lib>
                    <lib>${java.home}/lib/jce.jar</lib>
                </libs>
            </configuration>
        </plugin>
    </plugins>
</build>
+5

allatori obfuscator. . env ALLATORI_LIB=LOCATION/lib

: .

//, , . allatori-config.xml ( - , )

allatori-config.xml :

<config>
  <keep-names>
   <!--Specify the class and fields here-->
  </keep-names>
  <jars>
    <jar in="${obf.jar}" out="${obf.jar}"/>
  </jars>
  <property name="log-file" value="target/allatori-log.xml"/>
</config>

maven maven-antrun-plugin .

<plugin>
   <artifactId>maven-antrun-plugin</artifactId>
   <version>1.7</version>
   <executions>
       <execution>
           <phase>package</phase>
           <id>obfuscate2</id>
           <configuration>
               <target unless="${obfuscation.skip}">
               <echo message="running allatori"/>
               <property name="obf.jar" value="target/${project.artifactId}-${project.version}.jar"/>
               <property name="runtime_classpath" refid="maven.runtime.classpath"/>
               <property name="compile_classpath" refid="maven.compile.classpath"/>
               <taskdef name="allatori" classname="com.allatori.ant.ObfuscatorTask" classpath="${env.ALLATORI_LIB}/allatori.jar:${runtime_classpath}:${compile_classpath}" />
               <allatori config="${basedir}/allatori-config.xml"/>
          </target>
          </configuration>
              <goals>
                 <goal>run</goal>
              </goals>
         </execution>
    </executions>
</plugin>
0

All Articles