You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by John Stauffer <jc...@yahoo.com> on 2007/06/15 18:37:57 UTC

Ant Plugin Tip

I am trying to use ant to develop a new packaging type, and have
everything working as expected, but have been unable to figure out how
to set the artifact file for the project as part of the packaging mojo.

According to the docs I've found, if I were using Java for this, I
would simply include the following line at the end of the mojo:

  package.getArtifact().setFile(new File("target/my-output.zip"));

Is there a mechanism to do the equivalent in ant? I've tried setting a
number of properties in my ant script, but none of them seem to work.
The error I end up with is: "The packaging for this project did not
assign a file to the build artifact".

I am trying to do the impossible?


       
____________________________________________________________________________________
Get the Yahoo! toolbar and be alerted to new email wherever you're surfing.
http://new.toolbar.yahoo.com/toolbar/features/mail/index.php

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Ant Plugin Tip

Posted by Kenney Westerhof <ke...@apache.org>.

John Stauffer wrote:
> I am trying to use ant to develop a new packaging type, and have
> everything working as expected, but have been unable to figure out how
> to set the artifact file for the project as part of the packaging mojo.
> 
> According to the docs I've found, if I were using Java for this, I
> would simply include the following line at the end of the mojo:
> 
>   package.getArtifact().setFile(new File("target/my-output.zip"));

that'd be wrong. You should use 

                projectHelper.attachArtifact( project, type, classifier, outputFile );

and have it injected with 

    /** @component */
    private MavenProjectHelper projectHelper;

in a mojo.

> Is there a mechanism to do the equivalent in ant? I've tried setting a
> number of properties in my ant script, but none of them seem to work.
> The error I end up with is: "The packaging for this project did not
> assign a file to the build artifact".
> 
> I am trying to do the impossible?

Yes, right now there's no way to alter the MavenProject instance from Ant.
I don't even think there's an ant task for it atm..

-- Kenney
> 
> 
>        
> ____________________________________________________________________________________
> Get the Yahoo! toolbar and be alerted to new email wherever you're surfing.
> http://new.toolbar.yahoo.com/toolbar/features/mail/index.php
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org