Java 用ProGuard混淆GWT Web应用程序
我试图使用Proguard混淆我的GWT(Vaadin)应用程序。我以前从未混淆过java代码,这是我第一次尝试使用Proguard 我的配置文件设置如下:Java 用ProGuard混淆GWT Web应用程序,java,gwt,obfuscation,vaadin,proguard,Java,Gwt,Obfuscation,Vaadin,Proguard,我试图使用Proguard混淆我的GWT(Vaadin)应用程序。我以前从未混淆过java代码,这是我第一次尝试使用Proguard 我的配置文件设置如下: -libraryjars JAVA_HOME\rt.jar -libraryjars MYPATH\test\WebContent\WEB-INF\lib\appfoundation.jar -libraryjars MYPATH\test\WebContent\WEB-INF\lib\blackboard-2.1.1.jar -libra
-libraryjars JAVA_HOME\rt.jar
-libraryjars MYPATH\test\WebContent\WEB-INF\lib\appfoundation.jar
-libraryjars MYPATH\test\WebContent\WEB-INF\lib\blackboard-2.1.1.jar
-libraryjars MYPATH\test\WebContent\WEB-INF\lib\cssinject-0.9.jar
-libraryjars MYPATH\test\WebContent\WEB-INF\lib\eclipselink.jar
-libraryjars MYPATH\test\WebContent\WEB-INF\lib\eclipselink-jpa-modelgen_2.0.2.v20100323-r6872.jar
-libraryjars MYPATH\test\WebContent\WEB-INF\lib\gwt-visualization.jar
-libraryjars MYPATH\test\WebContent\WEB-INF\lib\iText-5.0.4.jar
-libraryjars MYPATH\test\WebContent\WEB-INF\lib\javax.persistence_1.0.0.jar
-libraryjars MYPATH\test\WebContent\WEB-INF\lib\javax.persistence_2.0.0.v201002051058.jar
-libraryjars MYPATH\test\WebContent\WEB-INF\lib\vaadin-6.4.4.jar
-libraryjars MYPATH\test\WebContent\WEB-INF\lib\vaadin-calendar-0.5.1.jar
-libraryjars MYPATH\test\WebContent\WEB-INF\lib\vaadin-chameleon-theme-1.0.1.jar
-libraryjars MYPATH\test\WebContent\WEB-INF\lib\VisualizationsForVaadin.jar
-libraryjars "C:\Program Files\eclipse\configuration\com.vaadin.integration.eclipse\download\gwt-dev\2.0.3\gwt-dev.jar"
-libraryjars "C:\Program Files\eclipse\configuration\com.vaadin.integration.eclipse\download\gwt-user\2.0.3\gwt-user.jar"
-injars test.war
-outjar test_after.war
-printseeds
-ignorewarnings
-keep public class TestApplication extends com.vaadin.Application {
public void init();
}
然后,我使用proguard命令执行:
java -jar proguard.jar @test.pro
我没有得到任何错误的配置文件,但我收到了很多警告。输出文件已创建,但我担心警告。我是否需要在配置文件中进一步指定jar文件?我已经列出了我在应用程序中使用的所有罐子。还有什么我做错的吗
下面是命令行输出的最后20行截图
提前谢谢
美国
GWT生成代码分为两部分
样式的OBF
。这将彻底混淆您的代码。您可能会更进一步,通过另一个JS模糊器运行它,尽管回报递减定律、bug等适用
我建议您了解当您提供OBF作为样式时生成的内容。这对你的目的来说可能已经足够了。显然,您在服务器端添加的内容越多(例如,安全性、cookie验证等),客户端中的代码就越不重要。应用程序发送到浏览器的部分不再是java,而是简单的旧javascript(这是GWT的核心思想)。根据您的GWT设置,它已经非常模糊(尽管GWT的主要目标是缩小)。除非您担心有人可以访问您的服务器读取类文件,否则混淆java部分没有什么意义。我不会在我的服务器上托管代码,它将提供给客户端。我宁愿混淆代码。输出文件不包括我的代码。它有所有的库jar,但我的实际代码不在输出文件中。它确实为我的代码创建了一个jar文件,但其中只有一个css文件-没有java代码:(关于为什么我的java代码没有包含在proguard输出文件中,你有什么想法吗?谢谢locka,我通过eclipse编译我的项目。你能给我一些关于如何为GWT编译器指定-style OBF的建议吗?谢谢我将GWT与maven一起使用,所以我不知道与eclipse集成的GWT的确切功能。这份文档建议你可以更改设置。)从GWT编译按钮-。更改设置,然后检查生成的.htm输出,查看其是否已模糊。
Maybe this is library method 'sun.jdbc.odbc.JdbcOdbcStatement { java.sql.Connection getConnection(); }'
Maybe this is library method 'sun.jdbc.odbc.ee.CommonDataSource { java.sql.Connection getConnection(); }'
Maybe this is library method 'sun.jdbc.odbc.ee.ConnectionPoolDataSource {java.sql.Connection getConnection(); }'
Maybe this is library method 'sun.jdbc.odbc.ee.DataSource { java.sql.Connection getConnection(); }'
Maybe this is library method 'sun.jdbc.odbc.ee.PooledConnection { java.sql.Connection getConnection(); }'
Maybe this is library method 'sun.rmi.transport.StreamRemoteCall { sun.rmi.transport.Connection getConnection(); }'
Note: org.eclipse.persistence.sdo.helper.DynamicClassWriter accesses a declared method 'writeReplace()' dynamically
Maybe this is program method 'org.eclipse.persistence.sdo.SDODataObject {java.lang.Object writeReplace(); }'
Maybe this is program method 'org.eclipse.persistence.sdo.helper.ListWrapper { java.lang.Object writeReplace(); }'
Maybe this is library method 'com.sun.corba.se.impl.presentation.rmi.InvocationHandlerFactoryImpl$CustomCompositeInvocationHandlerImpl {
Note: there were 4 unresolved dynamic references to classes or interfaces.
You should check if you need to specify additional program jars.
Note: there were 10 accesses to class members by means of introspection.
You should consider explicitly keeping the mentioned class members
(using '-keep' or '-keepclassmembers').
Warning: there were 3649 unresolved references to classes or interfaces.
You may need to specify additional library jars (using '-libraryjars').
Warning: there were 173 unresolved references to program class members.
Your input classes appear to be inconsistent.
You may need to recompile them and try again.
Alternatively, you may have to specify the option
'-dontskipnonpubliclibraryclassmembers'.