allator 对springBoot进行加密
1.对springboot项目添加jar包和xml文件

allatori.xml:
<config>
<input>
<jar in="target/spring-boot-01-helloworld-0.0.1-SNAPSHOT.jar" out="target/spring-boot-01-helloworld-0.0.1-SNAPSHOT-jm.jar"/>
</input>
<keep-names>
<class access="protected+">
<field access="protected+"/>
<method access="protected+"/>
</class>
</keep-names>
<property name="log-file" value="log.xml"/>
</config>
2.在pom.xml中添加插件:
<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>
<!-- Running Allatori -->
<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>
<!-- Copy allatori.jar to 'allatori' directory to use the commented line -->
<argument>${basedir}/jar/allatori.jar</argument>
<!-- <argument>${basedir}/allatori/allatori.jar</argument> -->
<argument>${basedir}/allatori.xml</argument>
</arguments>
</configuration>
</plugin>
3.利用maven命令先 clean 再 package,最终再target目录下会出现加密后的jar包


浙公网安备 33010602011771号