proguard-with-maven


FIY, the latest ProGuard(4.11) doesn’t work with JDK 8. And the 5.0(beta) is on its way.

In my previous entry(profiling the bootstrap classes for proguard in maven), I tried to use different profiles for denoting system-dependent JDK libraries used with proguard in maven.

Things change.

I wrote a simple maven project using same aliases for those JDK libraries.

clone it out

$ git clone git@github.com:jinahya/proguard-with-maven-example.git

pom.xml

/project/properties

<project ...>
  ...
  <properties>
    <java.bootstrap.classes>
      ${java.home}/lib/rt.jar
    </java.bootstrap.classes>
    <java.cryptographic.extension.classes>
      ${java.home}/lib/jce.jar
    </java.cryptographic.extension.classes>
    <java.secure.socket.extension.classes>
      ${java.home}/lib/jsse.jar
    </java.secure.socket.extension.classes>
  </properties>
  ...
</project>

/project/build/plugins

<project ...>
  ...
  <build>
    ...
    <plugins>
      ...
      <plugin>
        <!--groupId>com.pyx4me</groupId-->
        <groupId>com.github.wvengen</groupId>
        <artifactId>proguard-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>proguard</id>
            <phase>package</phase>
            <goals>
              <goal>proguard</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <options>
            <option>-keep public class * { public protected *; }</option>
          </options>
          <libs>
            <lib>${java.bootstrap.classes}</lib>
            <lib>${java.cryptographic.extension.classes}</lib>
            <lib>${java.secure.socket.extension.classes}</lib>
          </libs>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>net.sf.proguard</groupId>
            <artifactId>proguard-base</artifactId>
            <version>4.10</version>
            <scope>runtime</scope>
          </dependency>
        </dependencies>
      </plugin>
    ...
  </build>
  ...
  <!--profiles--> <!-- no profiles @ * -->
  ...
</project>

I tested with following systems.

Windows 7

>java -version
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b16)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)

>mvn --version
Apache Maven 3.1.0 (893ca28a1da9d5f51ac03827af98bb730128f9f2; 2013-06-28 11:15:32+0900)
Maven home: D:\programs\apache-maven-3.1.0\bin\..
Java version: 1.7.0_25, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_25\jre
Default locale: en_US, platform encoding: MS949
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"

>mvn --quiet clean package
 [proguard] ProGuard, version 4.10
 [proguard] Reading program jar [\...\..._proguard_base.jar] (filtered)
 [proguard] Reading library jar [C:\Program Files\Java\jdk1.7.0_25\jre\lib\rt.jar]
 [proguard] Reading library jar [C:\Program Files\Java\jdk1.7.0_25\jre\lib\jce.jar]
 [proguard] Reading library jar [C:\Program Files\Java\jdk1.7.0_25\jre\lib\jsse.jar]
 [proguard] Preparing output jar [\...\proguard-with-maven-1.0-SNAPSHOT.jar]
 [proguard]   Copying resources from program jar [\...\..._proguard_base.jar] (filtered)

>

Ubuntu 13.04 Server

$ java -version
java version "1.7.0_25"
OpenJDK Runtime Environment (IcedTea 2.3.10) (7u25-2.3.10-1ubuntu0.13.04.2)
OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)

$ mvn -version
Apache Maven 3.1.0 (893ca28a1da9d5f51ac03827af98bb730128f9f2; 2013-06-28 11:15:32+0900)
Maven home: /opt/apache-maven-latest
Java version: 1.7.0_25, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.8.0-27-generic", arch: "amd64", family: "unix"

$ mvn --quiet clean package
 [proguard] ProGuard, version 4.10
 [proguard] Reading program jar [/.../..._proguard_base.jar] (filtered)
 [proguard] Reading library jar [/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/rt.jar]
 [proguard] Reading library jar [/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/jce.jar]
 [proguard] Reading library jar [/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/jsse.jar]
 [proguard] Preparing output jar [/.../proguard-with-maven-1.0-SNAPSHOT.jar]
 [proguard]   Copying resources from program jar [/.../..._proguard_base.jar] (filtered)

$

Xubuntu 13.04 Desktop

$ java -version
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) Client VM (build 23.25-b01, mixed mode)

$ mvn --quiet clean package
Apache Maven 3.1.0 (893ca28a1da9d5f51ac03827af98bb730128f9f2; 2013-06-28 11:15:32+0900)
Maven home: /opt/apache-maven-latest
Java version: 1.7.0_25, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-oracle/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.8.0-27-generic", arch: "i386", family: "unix"

$ mvn --quiet clean package
 [proguard] ProGuard, version 4.10
 [proguard] Reading program jar [/.../..._proguard_base.jar] (filtered)
 [proguard] Reading library jar [/usr/lib/jvm/java-7-oracle/jre/lib/rt.jar]
 [proguard] Reading library jar [/usr/lib/jvm/java-7-oracle/jre/lib/jce.jar]
 [proguard] Reading library jar [/usr/lib/jvm/java-7-oracle/jre/lib/jsse.jar]
 [proguard] Preparing output jar [/.../proguard-with-maven-1.0-SNAPSHOT.jar]
 [proguard]   Copying resources from program jar [/.../..._proguard_base.jar] (filtered)

$ 

OS X

$ java -version
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)

$ mvn --version
Apache Maven 3.1.0 (893ca28a1da9d5f51ac03827af98bb730128f9f2; 2013-06-28 11:15:32+0900)
Maven home: /usr/local/Cellar/maven/3.1.0/libexec
Java version: 1.7.0_25, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.8.4", arch: "x86_64", family: "mac"

$ mvn --quiet clean package
 [proguard] ProGuard, version 4.10
 [proguard] Reading program jar [/.../..._proguard_base.jar] (filtered)
 [proguard] Reading library jar [/.../rt.jar]
 [proguard] Reading library jar [/.../jce.jar]
 [proguard] Reading library jar [/.../jsse.jar]
 [proguard] Preparing output jar [/.../proguard-with-maven-1.0-SNAPSHOT.jar]
 [proguard]   Copying resources from program jar [/.../..._proguard_base.jar] (filtered)

$ 
Advertisements

One comment

  1. Pingback: profiling the bootstrap classes for proguard in maven | jinahya

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s