Bug 663236 - cannot parse any valid ant bundle recipe
Summary: cannot parse any valid ant bundle recipe
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: RHQ Project
Classification: Other
Component: Provisioning
Version: 4.0.0.B02
Hardware: All
OS: All
high
high
Target Milestone: ---
: ---
Assignee: John Mazzitelli
QA Contact: Corey Welton
URL:
Whiteboard:
Depends On: 663517
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-12-15 04:07 UTC by John Mazzitelli
Modified: 2011-05-24 01:07 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-05-24 01:07:37 UTC
Embargoed:


Attachments (Terms of Use)

Description John Mazzitelli 2010-12-15 04:07:14 UTC
Description of problem:

Try to create a bundle with this recipe and you'll see that you get an error during the server plugin parsing and the bundle never gets created.

----

<?xml version="1.0"?>
<project name="small-bundle" default="main" xmlns:rhq="antlib:org.rhq.bundle">
    <rhq:bundle name="Small Bundle"
                version="1.0"
                description="a small bundle with a small.properties file">
        <rhq:deployment-unit name="jar">
            <rhq:file name="small-v1.properties" destinationFile="small.properties" replace="false"></rhq:file>
        </rhq:deployment-unit>
    </rhq:bundle>
    <target name="main"></target>
</project>


----

This is very bad - you cannot create any bundles now.

Comment 1 John Mazzitelli 2010-12-15 16:37:59 UTC
I'm slowly stepping through the ant code to find out why this is happening.

In ant-1.8.0.jar, there is org/apache/tools/ant/antlib.xml that has

<antlib>
  <!--
       This is the ant lib definition for ant.
       Currently it only contains componentdefinitions (restricted
       types that are not allowed at the top level)
       - conditions, selectors and comparators
       (those that are not top-level types (taskdefs or typedefs).
       defined in defaults.properties of taskdefs and types
       packages).

       This is currently experimental and it is most
       likely that these definitions will be placed
       in a Java Ant definition class.
  -->
  <!-- conditions -->
  <componentdef name="and" onerror="ignore"
       classname="org.apache.tools.ant.taskdefs.condition.And"/>

...

And its this "componentdef" element that is causing the failure.

Caused by: jar:file:/home/mazz/source/rhq/dev-container/jbossas/server/default/tmp/rhq-serverplugin-ant-bundle-4.0.0-SNAPSHOT.jar8787925329015629249.classloader/ant-1.8.0.jar3111823738470452321.tmp!/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.
	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.taskdefs.Antlib.execute(Antlib.java:162)
	at org.apache.tools.ant.taskdefs.Definer.loadAntlib(Definer.java:443)

I have no idea how any of this worked before. This is nothing that we apparently touched recently and this is core Ant stuff. Perhaps its introduced with ant 1.8? But I thought RHQ 3.0.0.GA shipped with that version?

Comment 2 John Mazzitelli 2010-12-15 16:45:06 UTC
geezz...

http://ant.1045680.n5.nabble.com/Failed-to-create-task-error-in-ant-td2263552.html

"I got the same error. Fixed as follows: replaced the all componentdef to typedef into <ant_home_dir>/lib/ant.jar!/org/apache/tools/ant/antlib.xml file. Works fine!! ;)"

Here's another odd one, but doesn't look as authoritative as above:

http://osdir.com/ml/user-ant-apache/2010-04/msg00081.html

"I found a workaround. ... if I put a property task before the import, it seems to work fine. ... I have no idea why this same issue doesn't happen in
either command line with Ant 1.8, or with Eclipse using Ant 1.7."

Comment 3 John Mazzitelli 2010-12-15 21:44:54 UTC
spent today doing git bisect and found the following as the commit that introduced the problem:

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

9972429183bee20d1a973eae55c1c9b75832b546 is first bad commit
commit 9972429183bee20d1a973eae55c1c9b75832b546
Author: Filip Drabek
Date:   Fri Nov 5 10:39:42 2010 +0100

    code coverage - new profile for plugin modules, antrun plugin version specified in parent module, test scope removed because of maven3

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

The commit's parent (which was the last good one prior to that) is:

a95553d4829046f234204008881e62be1b0ad16e

Comment 4 John Mazzitelli 2010-12-16 02:06:08 UTC
I think this is fixed by adding <scope>test</scope> to the root pom.xml's cobertura dependency. testing now...

Comment 5 John Mazzitelli 2010-12-16 03:24:34 UTC
this fixes the problem : b37f3e2278ca08f5eddb43e275e300642fa9d850

that's the fix to bug 663517.

Comment 6 Sunil Kondkar 2011-03-01 12:29:39 UTC
Verified on Build#1056 (Version: 4.0.0-SNAPSHOT Build Number: 643ac4b) with the bundle creation with recipe option. Tried the recipe:

<?xml version="1.0"?>
<project name="small-bundle" default="main" xmlns:rhq="antlib:org.rhq.bundle">
    <rhq:bundle name="Small Bundle"
                version="1.0"
                description="a small bundle with a small.properties file">
        <rhq:deployment-unit name="jar">
            <rhq:file name="small-v1.properties"
destinationFile="small.properties" replace="false"></rhq:file>
        </rhq:deployment-unit>
    </rhq:bundle>
    <target name="main"></target>
</project>

The bundle got created successfully.

Also created a bundle distribution file with above recipe and uploaded and created bundle successfully.

Marking the bug as verified.

Comment 7 Corey Welton 2011-05-24 01:07:37 UTC
Bookkeeping - closing bug - fixed in recent release.


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