使用Allatori对Spring Boot项目进行代码混淆

2 篇文章 0 订阅
1 篇文章 0 订阅

参考:

https://blog.csdn.net/rickiyeat/article/details/79386000

http://www.allatori.com/doc.html

https://zengyouyuan.iteye.com/blog/1947186

 

需要编辑的文件

1)pom.xml中添加插件

2)allatori.xml文件配置

3)jar包引用

4)maven命令

 

===============================================================

1)pom.xml中添加插件

<build>
   <finalName>${project.artifactId}</finalName>
   <plugins>
      <plugin>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-maven-plugin</artifactId>
      </plugin>
      <!-- mybatis generator 自动生成代码插件 -->
      <plugin>
         <groupId>org.mybatis.generator</groupId>
         <artifactId>mybatis-generator-maven-plugin</artifactId>
         <version>${mybatis-generator-maven-plugin-version}</version>
         <configuration>
            <configurationFile>${basedir}/src/main/resources/generator/generatorConfig.xml</configurationFile>
            <overwrite>true</overwrite>
            <verbose>true</verbose>
         </configuration>
      </plugin>

      <!-- Allatori plugin start -->
      <!-- Copying Allatori configuration file to 'target' directory.
          The destination file will be filtered (Maven properties used in configuration file will be resolved). -->
      <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-resources-plugin</artifactId>
         <version>3.1.0</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.6.0</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}/lib/allatori.jar</argument>
               <!-- <argument>${basedir}/allatori/allatori.jar</argument> -->
               <argument>${basedir}/allatori/allatori.xml</argument>
            </arguments>
         </configuration>
      </plugin>
      <!-- Allatori plugin end -->


   </plugins>
</build>

 

2)allatori.xml文件配置

<config>
   <input>
<!--      <dir in="../target/classes/" out="../target/filebim/WEB-INF/classes/"/>-->
      <dir in="../target/classes/" out="../target/classes/"/>
   </input>

   <keep-names>
      <class access="protected+">
         <field access="protected+"/>
         <method access="protected+"/>
      </class>
<!--      <class template="class com.bimbdip.config.*"/>-->
   </keep-names>
   <classpath>
      <!-- Adding library.jar to the classpath -->
<!--      <jar name="library.jar"/>-->
      <!-- Adding all jars in the lib directory to the classpath -->
<!--      <jar name="lib/*.jar"/>-->
      <!-- Adding all jars in the lib2 directory and its subdirectories to the classpath -->
      <jar name="../target/filebim/WEB-INF/lib/**/*.jar"/>
      <jar name="../lib/**/*.jar"/>
   </classpath>
   <property name="log-file" value="log.xml"/>
</config>

 

3)jar包引用

从官网下载allatori.jar  http://www.allatori.com/doc.html

tomcat-embed-core-9.0.13.jar

 

4)maven命令

mvn clean package org.codehaus.mojo:exec-maven-plugin:1.6.0:exec war:war

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值