You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "K.Srikumar" <ph...@yahoo.com> on 2006/01/03 12:12:41 UTC

Unable to archive properly

hai,
  Thank u for all the answers to my silly queries, here is a new one,
   
  I tried to create a jar file of the java classes in the dest folder, but
  it is creating a jar file with a info file namely """"Manifest.mf"""""" which doesnt have any class files at all,
  What could be the problem?
   
  The code i used is as follows:
   
  <!--Archiving the class files-->
   
   <!--Directory Creation-->
   
  <target name="createjar" description="Jars the class files">
<mkdir dir="${jardir-name}"/>
  <jar basedir="${jardir-name}" destfile="${jarfile-name}" includes="**/*.class"/>
  </target>
   
   <!--Archiving-->

  <target name="usejar" description="Runs the class from the Jar file" depends="compile,createjar">
<java classname="hello" classpath="${jarfile-name}" fork="true"/>
</target>
   
  PS:
  ------------------------------------------------------------------------------------------------------------------
  For reference: The complete build script
  ===================
   
   <!--Project name and default target specification-->
<project name="compile" default="speak" basedir=".">
   <!--Setting the property tags for the frequently used names-->
  <property name="path" location="dest"/>  
<property name="jardir-name" location="c:\test\dest"/>
<property name="jarfile-name" value="hello.jar"/>
   
   <!-- Compiling the files-->
  <target name="compile">
 <mkdir dir="${path}" /> 
  <javac srcdir="src" destdir="${path}" /> 
</target>
   <!-- Simple Messaging to guide the user-->
  <target name="speak" description="Prints the developer's Name">
   <echo message="     You did not specify any target   "/>
 <echo message="       "/>
 <echo message="     K.Srikumar"/>
</target>
   <!-- Deleting the folder containing the class files -->
  <target name="clean" description="Clear the new dirs">
    <delete dir="${path}"/>
</target>
  
 <!-- Visiting all the targets -->
  <target name="doall" depends="compile,speak,clean" description="Run all the targets"/>
  <target name="-hidden">
<echo message="This is hidden"/>
</target>
   <!--Archiving the class files-->
   <!--Directory Creation-->
  <target name="createjar" description="Jars the class files">
<mkdir dir="${jardir-name}"/>
  <jar basedir="${jardir-name}" destfile="${jarfile-name}" includes="**/*.class"/>
  </target>
   <!--Archiving-->
<target name="usejar" description="Runs the class from the Jar file" depends="compile,createjar">
<java classname="hello" classpath="${jarfile-name}" fork="true"/>
</target>
   
  </project>
   
   
  bye


:)K  .  S  R  I  K  U  M  A  R
		
---------------------------------
Yahoo! Shopping
 Find Great Deals on Holiday Gifts at Yahoo! Shopping