• 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包

  • 相关阅读:
    关于flask-sesson
    自己动手写出静态网站与动态网站
    支付宝支付
    Scanner
    JAVA编程
    《剑指offer》经典面试50题
    java程序员常见面试题
    Java面试题(一) String相关
    Java集合总览
    写好Java代码的30条经验总结
  • 原文地址:https://www.cnblogs.com/zcjyzh/p/9728781.html
Copyright © 2020-2023  润新知