Proguard 4.5 and 4.6 for maven?

2011-06-01
2012-12-17
  • I would like to use Proguard 4.5 and 4.6 in my maven project.

    I know it is possible to configure the proguard-maven-plugin to use a specific version of proguard via the artifact delivered by net.sf.proguard, but the last version available is 4.4 which is outdated for more than a year.

    Is it possible to release net.sf.proguard's artifact for 4.5 and 4.6? Thanks !!!

    P.S.: The issue I am facing is that 4.6 keeps the classes I want in a processed .jar, while it does not in 4.4. The configuration file exactly the same. Thanks.

     
  • Just to explain the issue a little more:

                <plugin>
                    <groupId>com.pyx4me</groupId>
                    <artifactId>proguard-maven-plugin</artifactId>
                    <version>2.0.4</version>
                    <executions>
                       <execution>
                           <phase>package</phase>
                           <goals><goal>proguard</goal></goals>
                       </execution>
                    </executions>
                    <configuration>
                        <proguardVersion>4.6</proguardVersion>
                        <obfuscate>true</obfuscate>
                        <options>
                            <option>-target 1.6</option>
                            <option>-keep public class net.project.API.**</option>
                        </options>
                        <maxMemory>1024m</maxMemory>
                        <injar>${project.build.finalName}-jar-with-dependencies.jar</injar>
                        <outjar>${project.build.finalName}-proguard.jar</outjar>
                        <outputDirectory>${project.build.directory}</outputDirectory>
                        <proguardInclude>${basedir}/proguard.conf</proguardInclude>
                        <libs>
                            <lib>${java.home}/lib/rt.jar</lib>
                        </libs>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>net.sf.proguard</groupId>
                            <artifactId>proguard</artifactId>
                            <version>4.4</version>   <-- This is the limit
                            <scope>runtime</scope>
                        </dependency>
                    </dependencies>
                </plugin>
    

    We don't need to release a new version of com.pyx4me proguard-maven-plugin, we just need the new versions of net.sf.proguard proguard artifact(s). I think it is just a matter of releasing the jars on the central repository.

     
  • I am considering releasing those jars myself if no one can help. I have opened a thread on StackOverflow.

     
  • Eric Lafortune
    Eric Lafortune
    2011-06-03

    I've never worked on ProGuard for Maven, but if you can track down the people who did, they may be able to help.

    Eric

     
  • OK. I have implemented a small maven project to install the proguard jar in my local repository (as a workaround):

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
      <modelVersion>4.0.0</modelVersion>
        <groupId>net.dwst</groupId>
        <artifactId>MavenMissingJars</artifactId>
        <version>1.0</version>
        <packaging>jar</packaging>
        
        <name>Maven Missing Jars</name>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>2.3</version>
                    <executions>
                        <execution>
                            <id>dProguard-4.6</id>
                            <phase>generate-sources</phase>
                            <goals>
                                <goal>install-file</goal>
                            </goals>
                            <inherited>false</inherited>
                            <configuration>
                                <file>toinstall/4.6/proguard.jar</file>
                                <groupId>net.sf.proguard</groupId>
                                <artifactId>proguard</artifactId>
                                <version>4.6</version>
                                <packaging>jar</packaging>
                                <generatePom>true</generatePom>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
        
    </project>
    

    On just needs to put the proguard jar in the toinstall/4.6/ repository relative to the location of the pom.xml.