烦恼岁月

付出总是有回报的 take action follow your heart , or follow your head
posts - 40, comments - 5, trackbacks - 0, articles - 4

Java obfuscate

Posted on 2009-10-19 00:50 不需要解释 阅读(756) 评论(0)  编辑  收藏 所属分类: tools

there are lots tools about the java obfuscate. I know two.

(1)proguard

(2)yguard

the proguard support ant, maven. I use maven as the project and build tools. so I want use the maven proguard plugin, but It is not easy to use. so I use yguard.

in your pom.xml, you can  add:

    <plugin>
            <groupId>net.sf.mgp</groupId>
            <artifactId>maven-unclasses-plugin</artifactId>
            <version>0.0.2</version>
        </plugin>
        <plugin>
  <artifactId>maven-antrun-plugin</artifactId>
  <dependencies>
    <dependency>
      <groupId>yguard</groupId>
      <artifactId>yguard</artifactId>
      <version>2.3.0</version>
      <scope>system</scope>
      <systemPath>lib/yguard.jar</systemPath>
    </dependency>
  </dependencies>
  <executions>
    <execution>
      <phase>package</phase>
      <configuration>
        <tasks>
          <property refid="maven.compile.classpath"
            name="mvn.classpath"></property>
          <!-- <echo message="Using Maven Classpath: ${mvn.classpath}" /> -->
          <taskdef name="yguard"
            classname="com.yworks.yguard.YGuardTask"/>
          <yguard>
            <!-- Input file and output file is the same. -->
            <inoutpair
              in="${project.build.directory}/${project.build.finalName}.${project.packaging}"
              out="${project.build.directory}/${project.build.finalName}.jar"/>
            <!-- Obfuscate classes plus string references. -->
            <rename
              logfile="${project.build.directory}/yguard.log.xml"
              replaceClassNameStrings="true">
              <!-- Keep the only class to be used for easy running and its public method main(). -->
              <keep>
                  <class classes="public" methods="public">
                  <patternset>
                    <include name=”xx.xxx.xxx.util.ConnectionUtil"/>
                  </patternset>
                </class>
              </keep>
            </rename>
            <!-- There are some external libraries used - Maven knows details. -->
            <externalclasses>
              <pathelement path="${mvn.classpath}"/>
            </externalclasses>
          </yguard>
        </tasks>
      </configuration>
      <goals>
        <goal>run</goal>
      </goals>
    </execution>
  </executions>
</plugin>


It is very cool!!!.


只有注册用户登录后才能发表评论。


网站导航:
 
我实话告诉你们,我可是身经百战了.bbs我见的多了,哪个版我没灌过?你们要知道, 一塌糊 涂的triangle,PIC,SEX版,那比你们不知道厉害到哪里去了,我在那谈笑风声.你 们有一好就是无论在哪个版,什么话题都灌,但是灌来灌去的问题,都too simple, sometimes naive!你 们懂不懂呀?啊?所以说灌水啊,关键是要提高自己的知识水平.你 们啊,不要总想着弄个大坑,然后灌上十大,再把我羞辱一番……你们啊,naive!你们这 样灌是不行地!~那你問我支持 不支持灌水,我說支持,我常來這裡灌,你說支持不支持?