• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

setting up ANT

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All,

When I try to run ant through the command "ant" and its various versions like "ant -version", "ant -help", I get the following error message ...

Invalid implementation version between Ant core and Ant optional tasks.
core : 1.6.0
optional: 1.6.1

After googling out I found that I have to download Optional Jar files for certain tasks. My first impression after I visited the appropriate manual page that describes the optional jars is that I am not using any of those tasks mentioned. Here is my build file

<?xml version="1.0"?>
<!-- Build.xml sample xml file -->
<project name ="Learning Ant" basedir="." default ="compile">
<property name = "src.dir" value ="src"/>
<!-- Temporary build directories -->
<property name="build.dir" value="build"/>
<property name="build.classes" value="${build.dir}/classes"/>
<property name="build.lib" value="${build.dir}/lib"/>
<!-- Target to create the build directories prior -->
<!-- compile target. -->
<target name="prepare">
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.classes}"/>
<mkdir dir="${build.lib}"/>
</target>

<target name="clean" description="Remove alltemp files.">
<delete dir="${build.dir}"/>
</target>
<target name="compile" depends="prepare" description="Compiles all source code.">
<javac srcdir="${src.dir}" destdir="${build.classes}"/>
</target>
<target name="jar" depends="compile" description="Generates target.jar ">
<!-- Exclude unit tests from the final JAR file -->
<jar jarfile="${build.lib}/target.jar" basedir="${build.classes}" />
</target>
<target name="all" depends="clean,jar" description="Cleans, compiles, builds JAR "/>
</project>
</align>

What amazes me more is that for commands like "ant -version" which is not trying to execute any tasks, ant gives the same error message.

Please help this newbie get started

Thanks,

Praveen.
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Make sure the jar's you have in %ANT_HOME%\lib are only those for the core Ant installation. All of them should start "ant". Make sure you don't have optional.jar kicking around in there too. Also check your %ANT_HOME% doesn't point to a different version of ant than you expect it to.
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Alpha Ma,

Welcome to JavaRanch!

We ain't got many rules 'round these parts, but we do got one. Please change your display name to comply with The JavaRanch Naming Policy.

Thanks Pardner! Hope to see you 'round the Ranch!n
 
Praveen Kumar
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Paul,

Thanks for the reply. Per your suggestion I took out all the jars that were not starting with ant. There were actually two such and both are XML related jars. The problem still persists. Any other suggestion?

Thank You,

Rave.
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I suspect you've taken out xercesImpl.jar and xml-apis.jar? They actually are distributed with Ant (sorry, my earlier comment was a little too all inclusive) so won't be the problem. Your error suggest there is an optional jar from Ant 1.6.1 somewhere in your classpath when you try to run Ant. Check your classpath and check the jars in the %ANT_HOME%\lib directoy. If you can't find it, I'd delete your ant directory and unpack Ant again.
 
author & internet detective
Posts: 41878
909
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Rave",
Thank you for changing you name. Unfortunately, your display name is still invalid. Note that it must be two words: a first name and a last name.
[ May 18, 2004: Message edited by: Jeanne Boyarsky ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic