Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Eclipse and Ant

 
Karthik Veeramani
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried to run an ant script that compiles my project and runs junit cases, and create test reports. The script runs fine as long as I dont use ant's "junitreport" task. When I use it, I get this error -
"BUILD FAILED: java.lang.VerifyError: (class: org/apache/xerces/parsers/IntegratedParserConfiguration, method: configurePipeline signature: ()V) Incompatible type for getting or setting field"
I've copied the xalan.jar file into ant's lib folder. So the script runs fine if I dont use eclipse (just run ant in command line). I've also changed the ANT_HOME in eclipse to point to this folder. Still no luck. Please help.
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a symptom of a well-known incompatibility.
The trick is to copy the XML jar files from the eclipse distribution to the ant lib, so that both systems use the same versions.
 
Karthik Veeramani
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This was a very urgent issue for me. I did as u said (replacing the files) and it works gr8 now. Thank you so much for ur help !!!
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a quality document out there describing how to use an existing Ant script to its fullest from within Eclipse?
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there something which isn't working for you?
My ant scripts get pretty complicated but they all seem to work with eclipse.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Frank Carver:
Is there something which isn't working for you?

No, nothing specific. Lazy me was just wondering whether there would be an easy-read somewhere that I could use instead of the trial and error method
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I have a few "top tips".
  • Make sure ant and eclipse are using the same versions of jar files. If there is a conflict, eclipse is usually the picky one, so copy the jar file from the eclipse distribution
  • Make sure you set the "output folder" for eclipse compilations to be different to the directory where ant places its compiled class files. Both like to think they do incremental compilation, and can get confused if you do both.
    Right click your project in the package explorer and select "properties", then choose "Java build Path" and set the "Default Output Folder" to somewhere ant doesn't care about.
  • Set up ant tasks using

  • Run >> External Tools >> External Tools
    I've found it wise to set up a separate task for each group of targets I commonly use (clean,build), (deploy), etc.
  • Make sure you tell eclipse about any jars your build script needs from ant/lib. Be wary of just adding everything from that directory (see 1, above). Each time you add a jar, run your ant script again from eclipse to see if it has everything it needs.
    menu: Windows >> Preferences

  • Select Ant >> Runtime
    Click the "Add jars" button to add jars.
    Note that the "Add Folder" option is for directories of classes, so adding the ant/lib folder is unlikely to be any use, you need to add all the jars you use individually.
  • Remember that you can click the "man with red box" icon (?) to re-run the most recently reused external command, whch includes Ant scripts.

  • I hope some of the above has been helpful.
    [ July 02, 2003: Message edited by: Frank Carver ]
     
    Lasse Koskela
    author
    Sheriff
    Posts: 11962
    5
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Originally posted by Frank Carver:
    I hope some of the above has been helpful.

    Very. Thanks (again).
     
    Ilja Preuss
    author
    Sheriff
    Posts: 14112
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Originally posted by Frank Carver:
    Make sure you set the "output folder" for eclipse compilations to be different to the directory where ant places its compiled class files. Both like to think they do incremental compilation, and can get confused if you do both.

    Unless you want to use Ant to *complement* Eclipse (code generation, RMI compiling and similar things), of course...
     
    Chad McGowan
    Ranch Hand
    Posts: 265
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Originally posted by Frank Carver:
    This is a symptom of a well-known incompatibility.
    The trick is to copy the XML jar files from the eclipse distribution to the ant lib, so that both systems use the same versions.

    I just happened to run into this same problem today running an Ant script from wsad 5, which is also using Eclipse. I hadn't run into this problem before. Is this problem documented somewhere?
     
    Frank Carver
    Sheriff
    Posts: 6920
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    The problem has been mentioned on several archived mailing lists and bulletin boards. Now it's mentioned here too!
    Unfortunately it's one of those problems which is hard to search for unless you have an idea what the problem is in the first place. Try google for "eclipse incompatible xerces" or something like that.
     
    Phil Williams
    Greenhorn
    Posts: 6
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I have been having the same problems with 2.1 and ANT 1.5.3. I have copied the xerces jar files that come with eclipse into the ANT lib. Set the preferences to use my ANT_HOME dir (which properly grabs all the jars in the ANT lib dir) but am still having the same problem.
    Any ideas?
    Thanks,
    Phil
     
    Ed Burnette
    Author
    Ranch Hand
    Posts: 142
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Do you mean 2.1.0 or 2.1.1? The latter comes with a newer and less broken version of Ant.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic