I'm attaching a sample code to reproduce the issue mentioned above. Could
you please suggest a solution for this issue:
The build.xml file :
============================
<?xml version="1.0" encoding="UTF-8"?>
<project name="Base" default="compile" basedir=".">
<description> Build file </description>
<property environment="env"/>
<!-- Compile everything -->
<target name="compile"
description="Test the creation of Task ">
<echo>${ant.version}</echo>
<taskdef name="checkTask"
classname="Obfuscate"
classpath="/u/chittelk/"/>
<checkTask />
</target>
</project>
===================================
Java file:
===================================
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.taskdefs.Delete;
import org.apache.tools.ant.types.FileSet;
public class Obfuscate extends Task
{
private Project myProject;
/**
* ANT task name for Delete.
*/
private static final String DELETE_TASK = "Delete";
/**
* Executes the desObfuscate task.
*/
@Override
public void execute() throws BuildException
{
myProject = new Project();
// Create ANT tasks
Task delete = (Delete) myProject.createTask(DELETE_TASK);
}
}
=====================================================
Command invocation using ANT 1.8.2:
========================================
$> /prod/tools/infra/apache/ant-1.8.2/bin/ant compile
Buildfile: /u/chittelk/build.xml
compile:
[echo] Apache Ant(TM) version 1.8.2 compiled on December 20 2010
BUILD FAILED
/u/chittelk/build.xml:16: The following error occurred while executing this
line:
jar:file:/prod/tools/infra/apache/ant-1.8.2/lib/ant.jar!/org/apache/tools/ant/antlib.xml:37:
Problem: failed to create task or type componentdef
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.
Total time: 0 seconds
========================================
Command invocation using ANT 1.7.1:
=========================================
$> /prod/tools/infra/apache/ant-1.7.1/bin/ant compile
Buildfile: build.xml
compile:
[echo] Apache Ant version 1.7.1 compiled on June 27 2008
BUILD SUCCESSFUL
Total time: 0 seconds
========================================
--
View this message in context:
http://ant.1045680.n5.nabble.com/project-createTask-not-working-with-ant-1-8-2-tp3385716p3385725.html
Sent from the Ant - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]