Bug 728217 - macrodef ant task does not work in the bundle recipe xml file [NEEDINFO]
Summary: macrodef ant task does not work in the bundle recipe xml file
Keywords:
Status: NEW
Alias: None
Product: RHQ Project
Classification: Other
Component: Provisioning
Version: 4.0.1
Hardware: x86_64
OS: Linux
medium
medium vote
Target Milestone: ---
: ---
Assignee: RHQ Project Maintainer
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-08-04 12:16 UTC by Shashin Shinde
Modified: 2012-02-01 17:21 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed:
mazz: needinfo? (sshinde)


Attachments (Terms of Use)

Description Shashin Shinde 2011-08-04 12:16:15 UTC
Description of problem:

I have defined a standard macrodef task in the bundle recipe.xml file.
Using the rhq-bundle-deployer to test it fails with the message that it cannot identify the macrodef task.

Version-Release number of selected component (if applicable):

RHQ 4.0.1

How reproducible:


Steps to Reproduce:
1. Create a recipe.xml file with an ant macrodef task
2. run it with bundle deployer
3.
  
Actual results:
Stack trace

Expected results:
macrodef is a standard ant task and hence should be supported and should work

Additional info:

preinstall:
     [echo] Pre-Install Target Bundle v1.0 to /mnt/data/contentbundles/target...
RHQ_AUDIT_MESSAGE___FAILURE___Error Occurred___The deployment could not complete successfully.___org.apache.tools.ant.BuildException:Problem: failed to create task or type dosomething
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.
___/mnt/data/contentbundles/mybundle/deploy.xml:77: Problem: failed to create task or type dosomething
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.

	at org.apache.tools.ant.UnknownElement.getNotFoundException(UnknownElement.java:487)
	at org.apache.tools.ant.UnknownElement.makeObject(UnknownElement.java:419)
	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.Target.execute(Target.java:390)
	at org.apache.tools.ant.Target.performTasks(Target.java:411)
	at org.rhq.bundle.ant.type.DeploymentUnitType.install(DeploymentUnitType.java:131)
	at org.rhq.bundle.ant.task.BundleTask.execute(BundleTask.java:148)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	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.helper.ProjectHelper2.parse(ProjectHelper2.java:179)
	at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:80)
	at org.rhq.bundle.ant.AntMain.initProject(AntMain.java:761)
	at org.rhq.bundle.ant.AntMain.runBuild(AntMain.java:626)
	at org.rhq.bundle.ant.AntMain.startAnt(AntMain.java:213)
	at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
	at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)

BUILD FAILED
/mnt/data/contentbundles/mybundle/deploy.xml:77: Problem: failed to create task or type dosomething
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.

Comment 1 Charles Crouch 2011-08-11 04:04:36 UTC
Mazz, this look familar (a dupe) and I think you have a workaround right?

Comment 2 John Mazzitelli 2011-08-11 13:15:13 UTC
this is different but probably the same kind of issue we had with <antcall>:

http://rhq-project.org/display/JOPR2/Ant+Bundles#AntBundles-ProhibitedStandardAntTasks

It looks like macrodef is also a task that is prohibited too. I would try the same kind of workaround that we have for <antcall> - that is, what if you wrote a separate ant script, and called out to it via <ant> and in THAT separate ant script, you have your macrodef and you use the new macro in that separate ant script (???).

I haven't looked into it, but I suspect either we can't support macrodef due to the special way we start ANT internally OR we can support it, but we just have to write special code to do what standard ANT does to load in the new macros.

Right now, I'll document macrodef as one of the prohibited tasks since its clearly not working today, with the caveat that we can look to try to support it.

But first we need replication procedures and examples. Can you attach to this bugzilla a very simple bundle distribution file that includes a simple ANT recipe and any related files that demonstrate/replicate this problem? With a bundle that replicates the problem, we can use it to investigate a solution.


Note You need to log in before you can comment on or make changes to this bug.