Java – in POM The Proguard configuration file is included in the XML

I tried to confuse Java class files I've used ant before, so I've built it through 'build XML 'contains the following code to try to obfuscate them

<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 the Proguard configuration file Now I'm trying to do the same thing with Maven I'm learning maven, so I don't know how to be in 'POM XML 'does the same thing Thank you. I'm sorry

Solution

<plugin>
<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 content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>