-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

isn't artifact.getFile() null until something tries to resolve it, though?

- -j

Brett Porter wrote:
| I think you are only copying from the local repository though, so you
| can omit the remote repo and resolver.
|
| - Brett
|
| John Casey wrote:
|
| 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
| |
| |
|>
- ---------------------------------------------------------------------
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]



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFDaS9aK3h2CZwO/4URAk0hAJsHTO5Gy9wl4m02vI2mlmMjA8lUFQCeNpp+
nsQXY/oAQoXoB2qGYZshDsE=
=BOO2
-----END PGP SIGNATURE-----

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

Reply via email to