Dear Wim,
   For my sample--

<dependencies>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-plugin-api</artifactId>
     <version>2.0</version>
    </dependency>


pom.xml

<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>sample.plugins</groupId>
  <artifactId>maven-hello-plugin</artifactId>
  <packaging>maven-plugin</packaging>
  <!--<version>2.1-SNAPSHOT</version>-->
  <version>2</version>
  <name>Sample Parameter-less Maven Plugin</name>
  <dependencies>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-plugin-api</artifactId>
     <version>2.0</version>
    </dependency>
  </dependencies>
  <build>
    <sourceDirectory>src/main/java</sourceDirectory>
    <outputDirectory>target</outputDirectory>
  </build>
  <distributionManagement>
      <repository>
        <id>localrepo_server</id>
        <name>distribution repository</name>
        <url>file:///d:/m2localrepo/</url>
     </repository>
      <snapshotRepository>
        <id>localrepo_server</id>
        <name>distribution repository</name>
        <url>file:///d:/m2localrepo/</url>
     </snapshotRepository>

  </distributionManagement>
</project>







thanks.
Tel: (020)36315358-328 Fax: (020)36315170


                                                                                
                                                       
                      Wim Deblauwe                                              
                                                       
                      <[EMAIL PROTECTED]        To:       Maven Users List 
<users@maven.apache.org>                                     
                      il.com>                  cc:                              
                                                       
                                               Subject:  Re: [m2] Copy the 
dependencies of a project in a custom plugin                
                      21/11/2005 19:41                                          
                                                       
                      Please respond to                                         
                                                       
                      "Maven Users                                              
                                                       
                      List"                                                     
                                                       
                                                                                
                                                       
                                                                                
                                                       




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]
>
>

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________


Hactl..........Moving forward with you.

Best Air Cargo Terminal - Asia 2005
Air Cargo Terminal of the Year 2002, 2003 & 2004

Web: http://www.hactl.com

DISCLAIMER :-
The information contained in this message, including any attachment, is
confidential and may also be privileged. The information is intended only
for the person or entity to which it is addressed. Any review,
re-transmission, copying, storage, distribution or other use or disclosure
of this information by persons or entities other than the intended
recipient is prohibited. If you are not the intended recipient, please
contact the sender immediately by return email and delete this message from
your system. Thank you.




______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

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

Reply via email to