Maven 2.x Ant Tasks

The Dependencies task of Maven Antlib should override an existing path reference instead of failing

Details

  • Type: Wish Wish
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 2.0.6
  • Fix Version/s: 2.0.7
  • Component/s: dependencies task
  • Labels:
    None
  • Environment:
    Solaris 10, Ant 1.7.0, Maven Antlib 2.0.4
  • Number of attachments :
    0

Description

In the Maven Antlib 2.0.4 with Ant 1.7.0 when using the <dependencies> task with the pathId attribute:

<dependencies pathId="compile.path">
...
<dependencies>

The following error is raised if a "compile.path" reference already exists:

[maven:dependencies] An error has occurred while processing the Maven artifact tasks.
[maven:dependencies] Diagnosis:
[maven:dependencies]
[maven:dependencies] Reference ID compile.path already exists

In fact the error is raised even if the "compile.path" reference is defiend in another target whcih is not executed at runtime. This is due to Ant 1.7.0 which resolves references at parsing time so when the <dependencies> task get executed the "compile.path" reference already exists and the Maven <dependencies> task fails.

Other Ant tasks like the <path> task do not fail when a reference is already defined. They simply override the reference.

The maven :dependencies task should mimic the Ant <path> behaviour and accept to override a reference which is already defined.

This could be implemented by removing the following code from the DependenciesTask.doExecute() method:

if ( pathId != null && getProject().getReference( pathId ) != null )

{ throw new BuildException( "Reference ID " + pathId + " already exists" ); }

}

Issue Links

Activity

Hide
Jason van Zyl added a comment -

We will now reset path ids.

Show
Jason van Zyl added a comment - We will now reset path ids.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: