Here is my buildfile:
<project name="ant-in-eclipse" basedir="."
xmlns:ant4eclipse="antlib:org.ant4eclipse"
xmlns:antcontrib="antlib:net.sf.antcontrib" default="compileAndJar" >
<taskdef uri="antlib:net.sf.antcontrib"
resource="net/sf/antcontrib/antlib.xml" />
<!-- define ant4eclipse tasks -->
<taskdef uri="antlib:org.ant4eclipse"
resource="org/ant4eclipse/ant/antlib.xml" />
<import file="/data/temp/ANT/ANT4/macros/a4e-jdt-macros.xml"/>
<target name="compileAndJar">
<macrodef name="build">
<attribute name="workspaceDirectory" default="deploy" />
<sequential>
<echo>Hi</echo>
</sequential>
</macrodef>
<buildJdtProject workspaceDirectory="${workspaceDirectory}"
projectname="wfn-common.jar">
<finish>
<jar destfile="deploy/wfn-common.jar">
<ant4eclipse:jdtProjectFileSet destination="."
projectname="${buildJdtProject.project.name}" />
</jar>
</finish>
</buildJdtProject>
</target>
</project>
I am getting this error
/data/temp/ANT/PTO_Build/WFN_Framework/wfn-common/sample.xml:21: The following error occurred while executing this line:
/data/temp/ANT/ANT4/macros/a4e-jdt-macros.xml:105: ant4eclipse:executeJdtProject doesn't support the "workspaceid" attribute
at org.apache.tools.ant.RuntimeConfigurable.maybeConfigure(RuntimeConfigurable.java:396)
at org.apache.tools.ant.RuntimeConfigurable.maybeConfigure(RuntimeConfigurable.java:344)
at org.apache.tools.ant.Task.maybeConfigure(Task.java:202)
at org.apache.tools.ant.UnknownElement.configure(UnknownElement.java:196)
at org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:163)
at org.apache.tools.ant.Task.perform(Task.java:347)
at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:600)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:398)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:600)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:809)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: ant4eclipse:executeJdtProject doesn't support the "workspaceid" attribute.
at org.ant4eclipse.ant.jdt.containerargs.JdtClasspathContainerArgumentDelegate.setDynamicAttribute(JdtClasspathContainerArgumentDelegate.java:70)
at org.ant4eclipse.ant.jdt.AbstractExecuteJdtProjectTask.setDynamicAttribute(AbstractExecuteJdtProjectTask.java:63)
at org.apache.tools.ant.IntrospectionHelper.setAttribute(IntrospectionHelper.java:394)
at org.apache.tools.ant.RuntimeConfigurable.maybeConfigure(RuntimeConfigurable.java:388)
... 31 more
Can anyone please help me out?
The error is in the file you import:
I guess your
buildJDTProject
target is defined there and there is an error in how it is defined./data/temp/ANT/ANT4/macros/a4e-jdt-macros.xml
I'm guessing it will be at a
buildJDTProject
target. I'm guessing that target containsworkspaceid
attribute, which appears to be illegal.You could remove the attribute, or figure out why it was included in first place. Maybe it works with different version of your ant jdt library?
Two further guesses (I'm not familiar with ant4eclipse BTW). Regarding the buildJdtProject task of ant4eclipse...
The document says
You are passing
workspaceDirectory
in the target in your build script. MaybeworkspaceId
is specified by default in the macro in that imported file. If so, maybe you end up with bothworkspaceDirectory
ANDworkspaceId
defined and that is illegal. However, that idea doesn't match the error message you're getting.Alternatively, maybe ant4eclipse is case-sensitive about attribute names. That would be unusual for Ant, it is generally case-insensitive. But the ant4eclipse doc gives the attribute name as
workspaceId
and your error message saysworkspaceid
is not supported. So maybe try changing the case in that imported file.