[英]Include proguard configuration file in pom.xml
I am trying to obfuscate java class files. 我试图混淆java类文件。 I was using ant before, so i managed to obfuscate them during build process itself by including following code in 'build.xml'.
我以前使用过ant,因此我在构建过程中通过在'build.xml'中包含以下代码来设法对它们进行模糊处理。
<target name="-post-jfx-jar">
<!-- obfuscate and optimize by ProGuard -->
<taskdef resource="proguard/ant/task.properties" classpath="lib/proguard.jar" />
<proguard configuration="config.pro">
</proguard>
<move
file="${dist.jar.dir}/${ant.project.name}.jar"
tofile="${dist.jar}" verbose="true" overwrite="true" />
</target>
'config.pro' is proguard configuration file. 'config.pro'是proguard配置文件。 Now i am trying to do same thing with maven.
现在我正在尝试用maven做同样的事情。 I am learning maven so i have no idea how to do same thing in 'pom.xml'.
我正在学习maven所以我不知道如何在'pom.xml'中做同样的事情。 Thank you and sorry for bad English.
谢谢你,对不起英语不好意思。
<plugin>
<groupId>com.pyx4me</groupId>
<artifactId>proguard-maven-plugin</artifactId>
<version>2.0.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>proguard</goal>
</goals>
</execution>
</executions>
<configuration>
<proguardVersion>5.0</proguardVersion>
<obfuscate>true</obfuscate>
<injar>${project.build.finalName}.jar</injar>
<outjar>${project.build.finalName}-small.jar</outjar>
<outputDirectory>${project.build.directory}</outputDirectory>
<proguardInclude>${basedir}/config.pro</proguardInclude>
<libs>
<lib>${java.home}/lib/rt.jar</lib>
<lib>${java.home}/lib/jsse.jar</lib>
</libs>
</configuration>
<dependencies>
<dependency>
<groupId>net.sf.proguard</groupId>
<artifactId>proguard</artifactId>
<version>5.0</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</plugin>
The project I had used it in doesn't seem to exist any longer here. 我用过它的项目似乎不再存在了。 It was just a temporary test project.
这只是一个临时测试项目。 We decided not to use Proguard eventually.
我们最终决定不使用Proguard。
However, I used the proguard-maven-plugin and created my POM according to its Usage section in conjunction with the ProGuard manual. 但是,我使用了proguard-maven-plugin并根据其用法部分和ProGuard手册创建了我的POM。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.