Bug 728217 - macrodef ant task does not work in the bundle recipe xml file [NEEDINFO]
macrodef ant task does not work in the bundle recipe xml file
Status: NEW
Product: RHQ Project
Classification: Other
Component: Provisioning (Show other bugs)
4.0.1
x86_64 Linux
medium Severity medium (vote)
: ---
: ---
Assigned To: RHQ Project Maintainer
Mike Foley
: FutureFeature, Improvement
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2011-08-04 08:16 EDT by Shashin Shinde
Modified: 2012-02-01 12:21 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
mazz: needinfo? (sshinde)


Attachments (Terms of Use)

  None (edit)
Description Shashin Shinde 2011-08-04 08:16:15 EDT
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 00:04:36 EDT
Mazz, this look familar (a dupe) and I think you have a workaround right?
Comment 2 John Mazzitelli 2011-08-11 09:15:13 EDT
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.