我的runnable jar裏面有一些第三方的罐子。我是否必須使用Proguard的-libraryjar選項指定這些庫,即使它們已經打包在主jar文件中?Proguard和第三方庫
目前我這些錯誤:
Warning: there were 171 unresolved references to classes or interfaces.
Warning: there were 394 instances of library classes depending on program classes.
Warning: there were 1 unresolved references to program class members.
如果我指定與-libraryjar選項Proguard的罈子裏很多警告關於重複類。
我的Ant構建:
<target name="jar" depends="compile">
<delete file="${destfile}" />
<jar destfile="${destfile}" filesetmanifest="mergewithoutmain" duplicate="preserve">
<manifest>
<attribute name="Main-Class" value="main.Main"/>
<attribute name="Class-Path" value="${classpath}"/>
</manifest>
<fileset dir="${target}" includes="**/*.class" />
<zipfileset excludes="META-INF/*.SF" src="lib1.jar" />
<zipfileset excludes="META-INF/*.SF" src="lib2.jar" />
<zipfileset excludes="META-INF/*.SF" src="lib3.jar" />
</jar>
</target>
<target name="dist" depends="jar">
<taskdef resource="proguard/ant/task.properties" classpath="${proguard}" />
<proguard>
-injars ${destfile}
-outjars ${destfileobfuscated}
-libraryjars C:/Java/jdk1.6.0_25/jre/lib/rt.jar;
C:/Java/jdk1.6.0_25/jre/lib/jsse.jar;
C:/Java/jdk1.6.0_25/jre/lib/jce.jar;
lib1.jar;
lib2.jar;
lib3.jar
-optimizationpasses 5
-overloadaggressively
-repackageclasses ''
-allowaccessmodification
-dontskipnonpubliclibraryclassmembers
-keepclasseswithmembers public class * {
public static void main(java.lang.String[]);
}
</proguard>
<move file="${destfileobfuscated}" tofile="${destfile}" />
</target>
我已經更新了我的問題,請檢查一下螞蟻的構建是否可以。 –