File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Ant, Maven and Other Build Tools and the fly likes Adding ANT Contrib tasks Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Adding ANT Contrib tasks" Watch "Adding ANT Contrib tasks" New topic
Author

Adding ANT Contrib tasks

Cindy Martin
Greenhorn

Joined: Jul 29, 2008
Posts: 10
Hello,

One of my team member facing the problem in running the ANT contrib tasks...we just tried to use one task in the build file and below are the error thrown...

The code of the build file :-
-----------------------

-----------------------

error thrown as :

------------------
[echo] The first five letters of the alphabet are:

BUILD FAILED
C:\Documents and Settings\sv47906\Desktop\Test\build.xml:6: Problem: failed to create task or type for
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.
-------------------------

we are working in eclipse and downloaded the ANT contrib jar file and added to ANT lib......Do i need to add any path in the code ? if it is, please give me an example of how to do it.

Can anyone help me out in executing this build file with contrib task ?

Thanks,
cindy
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

You also need to tell your build to recognize the tasks defined in the antcontrib library. To do this (if you placed the antcontrib jar file in ant's lib directory), add the following entry to your build:



JBoss In Action
Cindy Martin
Greenhorn

Joined: Jul 29, 2008
Posts: 10
Thanks Peter !!! It worked !!

Cindy
priya ramadass
Greenhorn

Joined: Dec 08, 2009
Posts: 1
I still face this issue. Even after placing the task reference. Any help is much appreciated.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

Priya, welcome to Java Ranch!

Obviously, you did something wrong. But if you don't tell use what it is that you did, how can we point out your mistake?
http://faq.javaranch.com/java/TellTheDetails
Kristian Klukon
Greenhorn

Joined: Feb 08, 2010
Posts: 1
priya ramadass wrote:I still face this issue. Even after placing the task reference. Any help is much appreciated.


Use <taskdef resource="net/sf/antcontrib/antlib.xml"/> instead of <taskdef resource="net/sf/antcontrib/antcontrib.properties"/> when using ant >= 1.6
Rahul Sudhakar Pawar
Greenhorn

Joined: Aug 18, 2010
Posts: 1
Kristian Klukon wrote:
priya ramadass wrote:I still face this issue. Even after placing the task reference. Any help is much appreciated.


Use <taskdef resource="net/sf/antcontrib/antlib.xml"/> instead of <taskdef resource="net/sf/antcontrib/antcontrib.properties"/> when using ant >= 1.6


Hey Kristian, Thanks a Lot! Your solution worked.
G Chhabra
Greenhorn

Joined: May 03, 2010
Posts: 3
Thanks Kristian! I was having the same issue that Priya had. Your reply helped me as well.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Adding ANT Contrib tasks
 
Similar Threads
Ant Build inside Eclipse Problem
Problem running ant script chapter 1 of ejb 3 in action with weblogic 10
Jikes in Ant
Problem: failed to create task or type for Cause: The name is undefined.
Custom ANT Task not working in <for> loop