The tag "@requiresDependencyResolution" has to be on the class, not the
parameter.

-----Original Message-----
From: Wim Deblauwe [mailto:[EMAIL PROTECTED] 
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 <[EMAIL PROTECTED]>:
>
> 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 <[EMAIL PROTECTED]> wrote:
> > What dependency do I need for the Artifact and Project classes in my
> Mojo?
> >
> > 2005/11/21, Brett Porter <[EMAIL PROTECTED]>:
> > >
> > > On 11/21/05, Wim Deblauwe <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to