I think you are only copying from the local repository though, so you can omit the remote repo and resolver.

- Brett

John Casey wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You'll need parameters like this:

/**
~ * @component
~ */
private org.apache.maven.artifact.factory.ArtifactFactory factory;

/**
~ * @component
~ */
private org.apache.maven.artifact.resolver.ArtifactResolver resolver;

/**
~ * @parameter expression="${localRepository}"
~ * @readonly
~ * @required
~ */
private org.apache.maven.artifact.repository.ArtifactRepository local;

/**
~ * @parameter expression="${project.remoteArtifactRepositories}"
~ * @readonly
~ * @required
~ */
private java.util.List remoteRepos;


and then use it like this:



org.apache.maven.artifact.Artifact artifact;

artifact = factory.createArtifact( groupId,
~                                   artifactId,
~                                   version,
~                                   scope,
~                                   type );

resolver.resolve( artifact, remoteRepos, local );



This will impose the following dependencies on your plugin:

org.apache.maven:maven-artifact:2.0
org.apache.maven:maven-artifact-manager:2.0

HTH,

John

Brian E. Fox wrote:
| Hello,
| I'm trying to create a plugin and the first thing I need to do is copy
| something from the repository to a folder so I can manipulate it. I'm
| trying to define my plugin configuration like this:
| <configuration>
|
| <groupId>junit</groupId>
|
| <artifactId>junit</artifactId>
|
| <version>3.8.1</version>
|
| </configuration>
|
|
|
| Now what I'd like to do is get an Artifact instance that represents this
| object so I can call getFile(). I've tried many different ways of
| calling artifactFactory.createArtifact with out luck. Can someone show
| me or point me to how to figure this out?
|
| Here is what I have currently:
|
|
| System.out.println("group:"+groupId+"Art:"+artifactId+"version:"+version
| );
|         this.artifactFactory = new DefaultArtifactFactory();
|
|
|
|         Artifact artifact = artifactFactory.createArtifact
| (groupId,artifactId,version,"jar",Artifact.SCOPE_COMPILE);
|
|
| System.out.println("Path:"+artifact.getFile().getAbsolutePath());
|
|
|
| I'm not sure if directly using the DefaultArtifactFactory is the right
| way, but I'm not sure how to get an instance from anywhere else.
|
| Is there an api reference for all the maven components somewhere? I
| think thats the most complicated part...trying to figure out what to use
| and then how to use it.
|
|
|
| Thanks,
|
| Brian
|
|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFDaRRcK3h2CZwO/4URAjC+AKCfKVT0jlZkY3cV7LfjQoSuU46rmwCfQlaM
WFs4N32pAd/eZiSraK0UqHY=
=Qw2Z
-----END PGP SIGNATURE-----

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