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

Chris,

If you're looking to retrieve only a particular dependency of a plugin
(the dependencies of the plugin project are what form the plugin's
classpath), then you might do well to use ${plugin.artifactMap}. This
Map instance is keyed by an artifact's groupId:artifactId, and you can use

org.apache.maven.artifact.ArtifactUtils.versionlessKey( String
groupId,                                                        String 
artifactId)

as a standard way of accessing it. The values are
org.apache.maven.artifact.Artifact instances, IIRC. If you want to get
the actual jar, though, you can call Artifact.getFile() which should
return the jar file used for that artifact.

Sorry to say that the documentation is a little weak right now, as we're
still killing bugs and firming up the last niggling design issues. As
you can see, there is a lot of information missing. Until we can firm up
our documentation, please don't hesitate to keep asking questions. This
will have the added benefit of showing us how best to document the system.

hope that helps,

- -john

Edwin Punzalan wrote:
| To get the artifacts that's relative only to your plugin, you can use
| ${plugin.artifacts}.
|
| Its the same as ${project.artifacts} except the "project" object is your
| plugin.
|
|
|
| Chris Berry wrote:
|
|> Thanks much for your answer.
|> When a plugin is called, I'm confused as to what Classpath the plugin
|> itself gets. I see the project gets what I would expect, the
|> <dependencies> from the POM -- at least that is what I see in
|> project.artifacts.
|>
|> But the plugin doesn't seem to get it's <dependencies>... When I print
|> System.getProperty("java.class.path") I see only::
|> [INFO] current Classpath=
|> c:\cwb-tools\ant\maven-2.0-beta-cwb/core/boot/classworlds-1.1-alpha-2.jar
|>
|> Is there a set of properties for plugins like there is for project
|> (i.e. plugin.artifacts)??
|>
|> Does classworlds take care of this somehow?? I know that, for example,
|> Ant must be on my Classpath because teh plugin is able to invoke it...
|>
|> Thanks,
|> -- Chris
|>
|>
|> On 8/23/05, Trygve Laugstøl <[EMAIL PROTECTED]> wrote:
|>
|>
|>> On Tue, Aug 23, 2005 at 05:52:59PM -0500, Chris Berry wrote:
|>>
|>>
|>>> Greetings,
|>>> I am trying to figure out how to pass on the Classpath to Ant. I know
|>>> how to do this programmatically in Ant (e.g. project.setProperty) .
|>>> What I am trying to work out is how pass on the Classpath from the
|>>> *plugin*. By trial and error, I see that ${project.artifacts} results
|>>> in a HashSet of JARs for the *project* -- not the plugin.
|>>> I have a couple of questions
|>>>
|>>> 1) Is there a relatively comprehensive list of standard properties
|>>> (e.g. project.artifacts) somewhere?? (i.e. Is there a plugin.artifacts
|>>> ?? -- How would one know that??) I apologize in advance if this is in
|>>> the docs somewhere -- I have looked through them, and don't see
|>>> anything -- but may have overlooked them.
|>>>
|>>
|>> Expressions that use the ${project..} prefix will query the current
|>> MavenProject object. Currently there doesn't seem to be a published
|>> javadoc site for the maven-project project so you'll have to read the
|>> sources for now.
|>>
|>> But it's worth noticing that the MavenProject object closely mimics the
|>> Model object which is documented in [1]. i.e: if you have the expression
|>> ${project.build.sourceDirectory} you would get the value "foo" from
|>>
|>> <project>
|>>  <build>
|>>    <sourceDirectory>foo</sourceDirectory>
|>>    ...
|>>
|>>
|>>
|>>> 2) How does one know what the Java (or whatever) equivalent of a
|>>> property would be. (e.g. project.artifacts converts to a HashSet --
|>>> How would one know that without resorting to trial-and-error??)
|>>>
|>>
|>> See the first answer, when referencing ${project} you're querying a
|>> MavenProject object.
|>>
|>>
|>>
|>>> 3) Are there shortcuts like plugin.getDependencyPath( "axis:ant" ) in
|>>> maven2. (BTW: I do not want to use Marmalade. I am interested only in
|>>> using either Java and/or Ant)
|>>>
|>>
|>> ${project.artifactMap}
|>>
|>> Artifacts in the map are keyed using:
|>>
|>> import org.apache.maven.artifact.ArtifactUtils;
|>> ArtifactUtils.versionlessKey( String groupId, String artifactId )
|>>
|>> [1]: http://maven.apache.org/maven2/maven-model/maven.html
|>>
|>> --
|>> Trygve
|>>
|>>
|>> -----BEGIN PGP SIGNATURE-----
|>> Version: GnuPG v1.4.1 (GNU/Linux)
|>>
|>> iD8DBQFDC61j4EbM92cyCUURAiAtAJ4/EkD5wsLn86i/9P05bSJOAarTzgCfeAzC
|>> XqCEOcF0zKp5hx/9KEyrCIc=
|>> =VEdv
|>> -----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]
|
|
|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFDC9X2K3h2CZwO/4URAj3uAJ49l6k2UhiBDRQBpZQMr4U3yw6ycwCfRIjq
qz8HcdkwD/fmo91l3KOAbRs=
=jlCv
-----END PGP SIGNATURE-----

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

Reply via email to