Issue Details (XML | Word | Printable)

Key: GROOVY-1260
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Paul King
Reporter: Jon Skeet
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
groovy

Using the Ant task with multiple targets fails

Created: 06/Mar/06 02:34 AM   Updated: 22/Nov/07 05:30 AM
Component/s: Ant integration
Affects Version/s: 1.0-JSR-5
Fix Version/s: 1.1-rc-2

Time Tracking:
Not Specified

Environment: Windows and Linux
Java 1.5
Ant 1.6.5


 Description  « Hide
From the mailing list wrap-up post by Dierk:

<quote>
def ant = new AntBuilder()
ant.ant(antfile:'build.xml'){
target(name:'one')
}

is working but

def ant = new AntBuilder()
ant.ant(antfile:'build.xml'){
target(name:'one')
target(name:'two')
}

is not. The flag 'targetAttributeSet' is set erroneously in org.apache.tools.ant.taskdefs.Ant#addConfiguredTarget.
(possible Ant bug?)
</quote>

(Having looked at the Ant source myself, I can only see targetAttributeSet being set in setTarget, so personally I suspect it's not an Ant bug.)

To find the mailing list thread, search for a subject of "AntBuilder.ant.target not working?" on Feb 23rd/24th 2006. (Web access to mailing list is down right now, hence the lack of URL.)



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Paul King added a comment - 16/Oct/07 11:45 PM
I don't know when this was fixed, but appears working now.

This groovy script:

def ant = new AntBuilder()
ant.ant(antfile: 'GROOVY-1260.xml') {
    target(name: 'one')
    target(name: 'two')
}

with this build file:

<project name="groovy-1260" default="one">
    <target name="one">
        <echo message="1"/>
    </target>
    <target name="two">
        <echo message="2"/>
    </target>
</project>

produces this output:

one:
     [echo] 1

two:
     [echo] 2