标签:混淆 插件 allatori basedir jar maven copy 代码
Step1.在pom中添加插件
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>copy-and-filter-allatori-config</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target</outputDirectory>
<resources>
<resource>
<directory>${basedir}/allatori</directory>
<includes>
<include>allatori.xml</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>run-allatori</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>java</executable>
<arguments>
<argument>-Xms128m</argument>
<argument>-Xmx512m</argument>
<argument>-jar</argument>
<argument>${basedir}/lib/allatori.jar</argument>
<argument>${basedir}/lib/allatori.xml</argument>
</arguments>
</configuration>
</plugin>
Step2.copy jar包到插件里配置的路径
Step3.编写配置文件,并放在插件里配置的路径下
示例配置:
<config>
<input>
<!-- in表示输出的原始jar包,out表示输出的混淆后的jar包,后者名称可自定义,也可以是war -->
<jar in="../target/akkaload-core-0.0.1-SNAPSHOT.jar"
out="../target/akkaload-core-0.0.1-SNAPSHOT.jar"/>
</input>
<keep-names>
<class access="protected+">
<field access="protected+"/>
<method access="protected+"/>
</class>
</keep-names>
<property name="log-file" value="log.xml"/>
<!-- 忽略的包或类,这些文件将不被混淆 -->
<ignore-classes>
<!-- 不要混淆主类 -->
<class template="class com.navi.akkaload.AkkaloadApplication" />
<!-- 不要混淆第三方的代码,否则会出现java.lang.NoClassDefFoundError -->
<class template="class org.dom4j.*" />
<class template="class akka.actor.*" />
<class template="class *alibaba*" />
<class template="class *org*" />
<class template="class *rabbitmq*" />
<class template="class *springframework*" />
<class template="class *lombok*" />
</ignore-classes>
<!-- 到期时间(到期后无法启动jar) 格式:yyyy/mm/dd-->
<!--<expiry date="2021/04/03" string="SERVICE EXPIRED!"/>-->
<!-- 随机命名混淆字符-->
<!--<property name="random-seed" value="abcdef ghnljk svi"/>-->
</config>
效果
标签:混淆,插件,allatori,basedir,jar,maven,copy,代码 来源: https://www.cnblogs.com/daheww/p/15713596.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。