Maven 2.x Ant Tasks

Allow install and deploy tasks to include attached artifacts

Details

  • Type: New Feature New Feature
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 2.0.6
  • Component/s: None
  • Labels:
    None
  • Number of attachments :
    1

Description

The install and deploy tasks should be able to include additional artifacts to attach when performing install/deploy operations.

Issue Links

Activity

Hide
Jason Dillon added a comment -

Attached patch adds support for nested <attach> elements for deploy and install, suitable for use like:

<target name="test-deploy-attached" depends="initTaskDefs">
    <echo message="test" file="${basedir}/target/sample-build-test.pom.asc"/>

    <artifact:deploy file="sample-build-test.pom">
        <pom file="sample-build-test.pom" />
        <remoteRepository refid="deploy.repository" />
        <attach file="${basedir}/target/sample-build-test.pom.asc" type="pom.asc"/>
    </artifact:deploy>
</target>

<target name="test-install-attached" depends="initTaskDefs">
    <echo message="test" file="${basedir}/target/sample-build-test.pom.asc"/>

    <artifact:install file="sample-build-test.pom">
        <pom file="sample-build-test.pom" />
        <localRepository refid="local.repository"/>
        <attach file="${basedir}/target/sample-build-test.pom.asc" type="pom.asc"/>
    </artifact:install>
</target>

Adds a InstallDeployTaskSupport class to hold common code, InstallTask and DeployTask extend from it.

Adds a AttachedArtifact class to hold the attached artifact details (file, type and classifier).

To get this to build I had to change the maven artifacts to use 2.0.6 (and build the maven-2.0.6 tag of the components tree).

I updated the sample.build.xml to add test-install-attached and test-deploy-attached targets to test with, as well as changed the layout of the deploy.repository to default.

Sorry, I tried to keep close the the current style, but its not easy to make my fingers add all that extra whitespace, so you prolly wanna reformat the new bits.

Show
Jason Dillon added a comment - Attached patch adds support for nested <attach> elements for deploy and install, suitable for use like:
<target name="test-deploy-attached" depends="initTaskDefs">
    <echo message="test" file="${basedir}/target/sample-build-test.pom.asc"/>

    <artifact:deploy file="sample-build-test.pom">
        <pom file="sample-build-test.pom" />
        <remoteRepository refid="deploy.repository" />
        <attach file="${basedir}/target/sample-build-test.pom.asc" type="pom.asc"/>
    </artifact:deploy>
</target>

<target name="test-install-attached" depends="initTaskDefs">
    <echo message="test" file="${basedir}/target/sample-build-test.pom.asc"/>

    <artifact:install file="sample-build-test.pom">
        <pom file="sample-build-test.pom" />
        <localRepository refid="local.repository"/>
        <attach file="${basedir}/target/sample-build-test.pom.asc" type="pom.asc"/>
    </artifact:install>
</target>
Adds a InstallDeployTaskSupport class to hold common code, InstallTask and DeployTask extend from it. Adds a AttachedArtifact class to hold the attached artifact details (file, type and classifier). To get this to build I had to change the maven artifacts to use 2.0.6 (and build the maven-2.0.6 tag of the components tree). I updated the sample.build.xml to add test-install-attached and test-deploy-attached targets to test with, as well as changed the layout of the deploy.repository to default. Sorry, I tried to keep close the the current style, but its not easy to make my fingers add all that extra whitespace, so you prolly wanna reformat the new bits.
Hide
Jason Dillon added a comment -

I don't think it is related to this change, but I noticed that a NPE gets throw when doing:

ant -f ./sample.build.xml test-install-attached test-deploy-attached

This spits out:

Buildfile: ./sample.build.xml

initTaskDefs:

test-install-attached:
[artifact:install] [INFO] Installing /Users/jason/ws/maven/install-deploy-attached/sample-build-test.pom to /Users/jason/ws/maven/install-deploy-attached/target/local-repo/org/apache/maven/test/sample-build-test/2.0-beta-4-SNAPSHOT/sample-build-test-2.0-beta-4-SNAPSHOT.jar
[artifact:install] [INFO] Installing /Users/jason/ws/maven/install-deploy-attached/target/sample-build-test.pom.asc to /Users/jason/ws/maven/install-deploy-attached/target/local-repo/org/apache/maven/test/sample-build-test/2.0-beta-4-SNAPSHOT/sample-build-test-2.0-beta-4-SNAPSHOT.pom.asc

initTaskDefs:

BUILD FAILED
/Users/jason/ws/maven/install-deploy-attached/sample.build.xml:37: java.lang.NullPointerException

The NPE comes from:

<artifact:pom file="pom.xml" id="maven.project"/>
Show
Jason Dillon added a comment - I don't think it is related to this change, but I noticed that a NPE gets throw when doing:
ant -f ./sample.build.xml test-install-attached test-deploy-attached
This spits out:
Buildfile: ./sample.build.xml

initTaskDefs:

test-install-attached:
[artifact:install] [INFO] Installing /Users/jason/ws/maven/install-deploy-attached/sample-build-test.pom to /Users/jason/ws/maven/install-deploy-attached/target/local-repo/org/apache/maven/test/sample-build-test/2.0-beta-4-SNAPSHOT/sample-build-test-2.0-beta-4-SNAPSHOT.jar
[artifact:install] [INFO] Installing /Users/jason/ws/maven/install-deploy-attached/target/sample-build-test.pom.asc to /Users/jason/ws/maven/install-deploy-attached/target/local-repo/org/apache/maven/test/sample-build-test/2.0-beta-4-SNAPSHOT/sample-build-test-2.0-beta-4-SNAPSHOT.pom.asc

initTaskDefs:

BUILD FAILED
/Users/jason/ws/maven/install-deploy-attached/sample.build.xml:37: java.lang.NullPointerException
The NPE comes from:
<artifact:pom file="pom.xml" id="maven.project"/>
Hide
Jason Dillon added a comment -

Added feature branch in the maven sandbox with this patch applied:

Show
Jason Dillon added a comment - Added feature branch in the maven sandbox with this patch applied:
Hide
Jason van Zyl added a comment -

Feature branch merged, thanks.

Show
Jason van Zyl added a comment - Feature branch merged, thanks.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: