This week's book giveaway is in the General Computing forum.
We're giving away four copies of Emmy in the Key of Code and have Aimee Lucido on-line!
See this thread for details.
Win a copy of Emmy in the Key of Code this week in the General Computing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Problem with ANT compiling but not doing jar

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Subject: Compiling & doing jar
Operating System:Windows NT
Iam using ant v 1.4.1 & I have done compilation succesfully but when I do
the jar of the compiled source I get the following Error
ant -buildfile compilejar.xml
Buildfile: compilejar.xml
compile:
jar:
BUILD FAILED
C:\Ant\jakarta-ant-1.4.1\bin\compilejar.xml:25: The <jar> task doesn't
support the "destfile" attribut
Total time: 1 second
Note: My classpath & ANT_HOME dont make any issue since Iam able to compile
& do other tasks
with the ant
All the Directory metioned in the xml file exsists

<?xml version="1.0" encoding="UTF-8"?>
<project name="Ant Demo" default="jar" basedir=".">
<!--Define Global properties. -->
<property environment="env"/>
<property name="buildDir" value="classes"/>
<property name="srcDir" value="src"/>
<property name="xalan" value="XML/xalan/xalan.jar"/>
<property name="xerces" value="XML/xalan/xerces.jar"/>
<property name="junit"
value="JUnit/junit3.7/junit.jar"/>

<path id="classpath">
<pathelement path="${buildDir}"/>
<pathelement path="${junit}"/>
<pathelement path="${xerces}"/>
<pathelement path="${xalan}"/>
</path>
<target name="compile" description="compiles source files">
<javac srcdir="${srcDir}" destdir="${buildDir}"
classpath="classpath"/>
</target>
<target name="jar" depends="compile"
description="To jar the Compiled Source" >
<jar basedir="${buildDir}"
destfile="${srcDir}/lib/demo.jar"/>
</target>
</project>
 
Ranch Hand
Posts: 775
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't see anything wrong with the attribute; destfile is supposed to be the required attribute for the jar task. You didn't provide any kind of fileset or includes indication for the files to place in the jar; I think that is the most likely cause for the message.
If that doesn't do it, the only thing that comes to mind is that you've named the build task "jar". I doubt that is the problem, but it is the only other thing I can think of.
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Replace destfile with jarfile. There is no destfile option on the jar task. I am looking at the documentation of ant 1.4.1.
Chandresh
 
Author
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
destfile is actually a valid attribute for Ant 1.5. jarfile will still work too, of course. Many tasks are standardizing on the destfile attribute to make them easier to use.
 
Evil is afoot. But this tiny ad is just an ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!