maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wim Deblauwe <wim.debla...@gmail.com>
Subject Re: [m2] Copy the dependencies of a project in a custom plugin
Date Mon, 21 Nov 2005 12:22:40 GMT
ok, thanks! That was it.

2005/11/21, Allison, Bob <robert.allison@qwest.com>:
>
> The tag "@requiresDependencyResolution" has to be on the class, not the
> parameter.
>
> -----Original Message-----
> From: Wim Deblauwe [mailto:wim.deblauwe@gmail.com]
> Sent: Monday, November 21, 2005 06:41
> To: Maven Users List
> Subject: Re: [m2] Copy the dependencies of a project in a custom plugin
>
>
> The collection of artifacts is empty. When I was using dependencies, it
> was
> not empty. What am I doing wrong? This is my code:
>
> /**
> * @goal process-resources
> * @description Copy the dependencies for the InstallShield Merge Module
> */
> public class MsmProcessResourcesMojo extends AbstractMojo
> {
> /**
> * @parameter expression="${project.artifacts}"
> * @requiresDependencyResolution
> */
> private Collection artifacts;
>
> /**
> * @parameter expression="${project.build.directory}/resources"
> */
> private File targetDirectory;
>
> public MsmProcessResourcesMojo()
> {
> }
>
> public void execute() throws MojoExecutionException,
> MojoFailureException
> {
> try
> {
> getLog().info( "Process Resources for InstallShield Merge Module..." );
> Iterator iterator = artifacts.iterator();
> while (iterator.hasNext())
> {
> Artifact artifact = (Artifact)iterator.next();
> FileUtils.copyFileToDirectory( artifact.getFile(), new File(
> targetDirectory, artifact.getType() + "s" ) );
> }
> }
> catch (IOException e)
> {
> throw new MojoExecutionException( "Error copying artifacts", e );
> }
> }
> }
>
> thank you,
>
> Wim
>
> 2005/11/21, Brett Porter <brett.porter@gmail.com>:
> >
> > maven-artifact and maven-project (though you may not need the project
> > dependency if you are just using the expression below as it is
> > runtime, and Mavne provides it).
> >
> > - Brett
> >
> > On 11/21/05, Wim Deblauwe <wim.deblauwe@gmail.com> wrote:
> > > What dependency do I need for the Artifact and Project classes in my
> > Mojo?
> > >
> > > 2005/11/21, Brett Porter <brett.porter@gmail.com>:
> > > >
> > > > On 11/21/05, Wim Deblauwe <wim.deblauwe@gmail.com> wrote:
> > > > > Hi,
> > > > >
> > > > > I'm writing a custom plugin and I need to copy the project's
> > > > dependencies
> > > > > from the local repository to a certain directory. How can I do
> this
> > > > best?
> > > >
> > > > You should use ${project.artifacts} instead which includes all the
> > > > transitive artifacts, and for which you can call
> artifact.getFile().
> > > >
> > > > Make sure you include @requiresDependencyResolution
> > > >
> > > > > question 2:
> > > > > When my plugin works, it will produce a different artifact
> (.msm),
> > how
> > > > > should I handle the 'instal' and 'deploy' of that artifact? Do I
> > need to
> > > > > write my own custom mojo for that or can I re-use the plugins
> > already
> > > > > written for .jar files?
> > > >
> > > > You can reuse the mojos, but you will still need to define the
> > > > customisations, which will require a plugin. There are examples in
> the
> > > > "introduction to the build lifecycle".
> > > >
> > > > Cheers,
> > > > Brett
> > > >
> > > >
> ---------------------------------------------------------------------
> > > > 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
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message