zoukankan      html  css  js  c++  java
  • 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包

  • 相关阅读:
    核心动画的使用
    核心动画的使用
    核心动画的使用
    异常上报功能Bugly简介
    核心动画的使用
    一种传统的程序模块化马甲包开发架构
    定时器、多线程
    核心动画
    Core Animation 核心动画
    核心动画的使用
  • 原文地址:https://www.cnblogs.com/zcjyzh/p/9728781.html
Copyright © 2011-2022 走看看