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

Unfortunately, the answer to the question about a master list of
parameter expressions is currently "no." I agree that it'd be nice
(tending toward crucial for new mojo devs) to have some documentation on
parameter expressions. The only excuse I can offer is that we've been
trying to stabilize the parameter expression support as well as get the
implementation in general running and stable before diving into
documentation and complementary tool support (like what you'd need to
query for a parameter expression API). I'll see if I can't put something
together in the maven-projecthelp-plugin...simply massage a reflective
lookup of the get*() methods in certain classes, listed below. In
addition, I've recently introduced the concept of "banned" and
"deprecated" parameter expressions...so this plugin would have to query
that info as well.

What I can give you right now is a set of pointers to the source code
where you can calculate the expressions you might need. For specific
questions, of course, we can answer directly as needed. Other than a few
"special" parameter expressions, like ${localRepository}, all params are
reflective lookups against a few key objects:

* ${project.*} == org.apache.maven.project.MavenProject
~    (under maven-project in SVN)

* ${plugin.*} == org.apache.maven.plugin.descriptor.PluginDescriptor
~    (under maven-plugin-descriptor in SVN)

* ${session.*} == org.apache.maven.execution.MavenSession
~    (under maven-core in SVN)

In addition, we have two syntaxes for accessing plexus components as
parameters (one is deprecated):

* @component role="" role-hint=""

* @parameter expression="${component.fully.qualified.role}" (deprecated)

HTH,

john


Chris Berry wrote:
| Thanks John,
| I guess what would be most helpful would be a list of what properties
| one can access. One can figure out types by trial-and-error -- the
| compiler will let you know. But there is really no guessing the
| property names. Although I gather that the Model (the hierarchy of XML
| elements) is transparently reflected by corresponding properties (e.g.
| project.build.plugins). Is that correct?? But other properties -- like
| those for plugins -- are not obvious. Is there any way (some API) to
| simply print all available properites (similar to
| System.getProperties())?? That would be very convenient.
| Thanks,
| -- Chris
|
|
| On 8/23/05, John Casey <[EMAIL PROTECTED]> wrote:
|
| 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
| |>>
| |>>
| |>>


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

iD8DBQFDDM1KK3h2CZwO/4URAvyWAKCZZ5HOyDACFqc738TG1HXUXz5iwwCcCPed
4Ht+b/qAz91NeEMjKf44C3E=
=tSqf
-----END PGP SIGNATURE-----

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

Reply via email to