Ant打包jar,程序的混淆

Ant打包jar,程序的混淆

cmd命令下:
Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.

C:\Documents and Settings\new>d:

D:\>cd D:\NetBeansProjects\testtest

D:\NetBeansProjects\testtest>ant
Buildfile: build.xml

init:
    [mkdir] Created dir: D:\NetBeansProjects\testtest\dist
    [mkdir] Created dir: D:\NetBeansProjects\testtest\build

copy:
     [copy] Copying 90 files to D:\NetBeansProjects\testtest\build

compile:
    [jocky] Jocky enabled
    [javac] Compiling 107 source files to D:\NetBeansProjects\testtest\build
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.

jar:
      [jar] Building jar: D:\NetBeansProjects\testtest\dist\test.jar

archive:

BUILD SUCCESSFUL
Total time: 16 seconds
D:\NetBeansProjects\testtest>

 

build.xml文件

<?xml version="1.0" encoding="UTF-8" ?>

<!--
  =======================================================================
    Apache Ant own build file

   Copyright (c) 2000-2004 The Apache Software Foundation.  All rights
   reserved.
    ant.java.version    the JVM version Ant detected; currently it can hold
                        the values "1.2", "1.3", "1.4" and "1.5".

  =======================================================================
-->
<project name="testtest" default="archive" basedir=".">
  <description>
      gui
  </description>

  <property environment="env"/>
  <property name="java.home" value="${env.JAVA_HOME}"/>
  <property name="ant.home" value="${env.ANT_HOME}"/>
  <property name="app.copyright" value=" Copyright (c) 2002 The Neusoft Software Foundation. All rights reserved."/> 
  
  <!--app  src --> 
  <property name="src" value="src"/>
  <!--app  lib--> 
  <property name="lib.dir"  value="lib"/>

  <property name="main-class" value="com.cjun.login.view.UserLoginView" />

 

  <!-- Creates the output directories  -->
  <taskdef resource="jockytasks"> </taskdef>

 <!-- outer jar lib --> 
  <path id="lib_class_path">
    <fileset dir="${lib.dir}" includes="**/*.jar"></fileset>
    <!-- <pathelement path="${java.home}/lib/tools.jar"/>  -->
  </path>

  <target name="init">
    <!-- Create the build directory structure used by compile -->
    <mkdir dir="dist" />
    <mkdir dir="build" />
  </target>

  <!-- Compiles into the output directories  -->
  <target name="compile" depends="copy" > 
    <jocky jar="D:\ant-1.7.1\lib\jocky.jar" enable="true" level="private"> </jocky> 
    <!-- Compile the java code from ${src} into ${build} -->
    <javac encoding="utf-8" destdir="build" debug="on" source="1.5" target="1.5"> 
      <src path="src"></src>
      <classpath refid="lib_class_path" />
    </javac>
  </target>


  <target name="copy" depends="init" > 
    <copy todir="build">
      <fileset dir="src" includes="**/*.properties"/>
      <fileset dir="src" includes="**/*.png"/>
      <fileset dir="src" includes="images/**"/>
      <fileset dir="src" includes="**/*.xml"/>
      <fileset dir="src" includes="META-INF/**"/>
    </copy>
  </target>


  <!-- Creates the archive  -->
  <!-- 
  <target name="archive" depends="compile" >
    <jar destfile="dist/testjiami.jar" basedir="bin2" />
  </target>
   -->
  <target name="jar" depends="compile">
    <jar destfile="dist/test.jar" basedir="build" >
      <manifest>
        <attribute name="Main-Class" value="${main-class}"/>
        <attribute name="Class-Path" value=" lib/appframework-1.0.3.jar lib/swing-worker-1.1.jar lib/hibernate3.jar lib/jdom.jar lib/jtds-1.2.jar lib/log4j-1.2.9.jar lib/commons-dbcp.jar lib/appframework-1.0.3.jar lib/commons-collections-3.0.jar lib/swing-worker-1.1.jar lib/dom4j-1.6.jar lib/commons-logging.jar lib/ehcache-1.1.jar lib/jta.jar lib/cglib-2.1.jar lib/asm.jar"/>
        <attribute name="X-COMMENT" value=" Main-Class will be added automatically by build"/>
      </manifest>
      <!-- <fileset dir="lib" includes="*.jar" /> -->
    </jar>
  </target>

  <target name="archive" depends="jar">
  </target>

  <!-- Cleans the output directories  -->
  <target name="clean" depends="init">
    <delete dir="build" />
    <delete dir="dist" />
  </target>
</project>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值