简体   繁体   中英

Proguard Obfuscation failed in Jenkins build using Maven - can't read classes.jar

I'm using Jenkins to build a Maven project on a Linux box and getting the following error:

[proguard] Error: Can't read [/usr/lib/jvm/java-6-openjdk-amd64/Classes/classes.jar] (No such file or directory)

I have installed JDK and set the JAVA_HOME variable to: /usr/lib/jvm/java-6-openjdk-amd64

However, if I take a look at the 'System Information' section of Jenkins I get two locations for java home:

java.home: /usr/lib/jvm/java-6-openjdk-amd64/jre

JAVA_HOME: /usr/lib/jvm/java-6-openjdk-amd64

When I run the project on MacOS the proguard plugin works perfectly so I know it has nothing to do with my project setup. Something I'm missing in Jenkins or how Java is installed on my Server?

You are using proguard plugin? Did you include the following in pom.xml?

<libs>
    <lib>${java.home}/Classes/classes.jar</lib>
</libs>

I guess, your development env is a mac box, and your jenkins is running in a linux box. So that's the problem.
The following settings could work in linux. And if you install Oracle Jdk 1.7 or 1.8 in mac, it will also ok.

<libs>
     <lib>${java.home}/lib/rt.jar</lib>
</libs>

My point is that the key of the problem is that the libs setting is from mac working with apple java6, and the jenkins is on linux.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM