我正在尝试使用 yguard 3.0.0 maven 插件混淆 JAR 文件。混淆的 JAR 几乎和预期的一样,它被缩小并且所有私有方法和变量都被重命名。我还需要重命名包名称并执行此操作,但是启动我的 Tomcat 所需的 spring XML 文件没有使用混淆包进行更新。
我的蚂蚁任务如下:
<configuration>
<tasks>
<property name="runtime-classpath" refid="maven.runtime.classpath"/>
<taskdef name="yguard" classname="com.yworks.yguard.YGuardTask" classpath="${runtime-classpath}"/>
<yguard>
<inoutpair in="C:/test/webapp.jar" out="C:/test/webapp_obfuscated.jar" />
<shrink>
<property name="error-checking" value="pedantic"/>
</shrink>
<rename>
<adjust replaceContent="true" replaceName="true">
<include name="ApplicationContext.xml"/>
</adjust>
</rename>
</yguard>
</tasks>
</configuration>
请注意,在我的示例中,我只尝试处理 ApplicationContext.xml,但该文件与无混淆版本保持相同的类名。我确定 yguard 任务正在对我的 ApplicationContext.xml 执行某些操作,因为我在文件中有一个标签,并且文件的路径已正确混淆,但类名和其他内容没有:
<!-- Properties ldap -->
<bean id="ldapProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean" scope="singleton">
<property name="ignoreResourceNotFound" value="true"/>
<property name="locations">
<list>
<value>classpath:A/A/B/E/ldap.properties</value> <--Obfuscated!-->
</list>
</property>
</bean>
<bean id="authenticationBO" class="com.grifols.grb.authentication.bo.AuthenticationBO" scope="singleton">
<property name="dbAccess" ref="dbAccessGRB"/>
<property name="usersSecurityBO" ref="usersSecurityBO" />
<property name="settings" ref="settings" />
<property name="ldapProperties" ref="ldapProperties" />
</bean>
根据Yguard 文档,我认为我只需要使用 replaceContent="true" 并详细说明哪个文件,但我不是
任何想法?我非常感谢您能提供的任何帮助。
伊万