-
Notifications
You must be signed in to change notification settings - Fork 1.1k
如何混淆JAVA代码以及如何混淆压缩JS和CSS
1、在APDPlat_Web项目的pom.xml文件中找到maven-antrun-plugin插件,注释或是取消注释插件就能控制是否执行对Jar的混淆。
<!--执行对Jar的混淆--><plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>${maven-antrun-plugin.version}</version>
<executions>
<execution>
<phase>package</phase>
<configuration>
<target>
<property name="compile_classpath" refid="maven.compile.classpath"/>
<property name="runtime_classpath" refid="maven.runtime.classpath"/>
<property name="test_classpath" refid="maven.test.classpath"/>
<property name="plugin_classpath" refid="maven.plugin.classpath"/>
<ant antfile="${basedir}/src/main/obfuscate/build.xml">
<target name="allatori"/></ant>
</target>
</configuration>
<goals>
<goal>run</goal></goals>
</execution>
</executions>
</plugin>
2、在每一个项目的pom.xml文件中找到yuicompressor-maven-plugin插件,注释或是取消注释插件就能控制是否执行对JS和CSS的混淆压缩。
<!--执行对JS和CSS的混淆压缩--><!-- The yuicompressor plugin will process the js files and css files in src/main/webapp, but they won't be included in the final war. -->
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>yuicompressor-maven-plugin</artifactId>
<version>${yuicompressor-maven-plugin}</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jslint</goal>
<goal>compress</goal>
</goals>
</execution>
</executions>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
<nosuffix>true</nosuffix>
<nomunge>false</nomunge>
<disableOptimizations>false</disableOptimizations>
<linebreakpos>7999</linebreakpos>
<excludes>
<exclude>**/FusionCharts/**</exclude>
<exclude>**/ckeditor/**</exclude>
<exclude>**/ckfinder/**</exclude>
<exclude>**/extjs/**</exclude>
<exclude>**/public/**</exclude>
</excludes>
</configuration>
</plugin>
3、经过1和2的修改之后,要按照依赖顺序重新运行每一个项目。