-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
One thing we're considering adding to m2 in the very near term is the
concept of dependencies that are tied directly to a plugin definition.
This is important for several use cases, not the least of which being
the use of non-core ant task libraries. Another use case might be the
inclusion of xdoclet modules, and yet another a testing harness for
integration testing an application.
With this feature, you'd only have to define the antrun plugin, along
with the axis dependency directly under the plugin definition. Then,
your ant script should be able to find the axis tasks in the plugin's
classpath.
As for locating plugin resources, it depends on what you're looking for.
If it's bundled with the plugin or one of its dependencies, you should
be able to use ClassLoader.getResource(..) to retrieve it by name. OTOH,
if you're trying to get the path to one of the plugin dependencies, you
can execute something similar to the following:
/**
~ * @parameter expression="${plugin.artifactMap}"
~ * @required
~ * @readonly
~ */
private Map pluginArtifacts;
public void execute()
{
~ String key = ArtifactUtils.versionlessKey( "depGroupId",
"depArtifactId" );
~ Artifact artifact = (Artifact) pluginArtifacts.get( key );
~ File depPath = artifact.getFile();
~ .
~ .
~ .
}
Does this answer your question, or am I misunderstanding?
- -john
Chris Berry wrote:
| Hi Kenney,
| I am using your plugin. Thanks. In fact, I've already extended it to
| allow it to set Ant's message level (so you can see Ant's <echo> when
| you need to).
|
| I believe that Ant + Maven is the sweet spot. What I'm trying to
| discern is the cleanest way to accomplish this.
|
| Say you want to use an "extended Ant" -- pulling in, say, the Axis Ant
| Tasks, or the ant-contrib Tasks, or whatever. I'm thinking that I will
| simply extend AbstractAntMojo with, say, AxisAntMojo. This will have
| the proper dependencies (axis:ant, etc) and when I call <ant
| inheritAll="true" inheritRefs="true" antfile="" > -- then I should be
| able to find these Tasks on the inherited Classpath (right??)
|
| I'm hoping that I will be able to ask the Plugin for it's resources --
| so that I can find the Ant buildfile easily. I'm still figuring it
| out...
|
| Thanks again,
| -- Chris
|
| On 8/24/05, Kenney Westerhof <[EMAIL PROTECTED]> wrote:
|
|>On Wed, 24 Aug 2005, Chris Berry wrote:
|>
|>Hi,
|>
|>In m2 you just specify that jar as a dependency in the pom of the plugin.
|>It's then automatically added to the runtime classpath of that plugin's
|>execution environment. Further, you can access the Plugin object and
|>it's properties in a Mojo.
|>
|>Btw, if you plan to use ant in your plugins, have a look at the
|>maven-antrun-plugin. If you plan to use it, you should make your plugin
|>depend upon it, and extend AbstractAntTask. You can then create tasks,
|>add them to a Target object, and execute them (using a parent method).
|>(the plugin is part of the m2 svn repository).
|>
|>-- Kenney
|>
|>
|>>Hi,
|>>In the bad old days of Jelly, we could type something like::
|>>plugin.getDependendcyPath( 'axis:ant' );
|>>And you got back the full path to a JAR -- so we could use it as::
|>> <ant:path id="axis.classpath">
|>> <ant:pathelement path="${plugin.getDependencyPath('axis:axis')}"/>
|>>Is there an equivalent helper function like this for Java??
|>>
|>>BTW: FWIW: I have no interest in using Marmalade. I want to use *only*
|>>Java + Ant when developing my plugins. In fact, I plan to do as much
|>>as possible with Ant and simply fire it from the Maven plugin
|>>structure. There is no reason to reinvent the wheel. Ant provides
|>>Tasks to do probably 95% of what I need done. Is well understood, well
|>>supported, and well documented. I see this sort of marraige between
|>>Maven and Ant as powerful combination.
|>>
|>>Thanks,
|>>-- Chris
|>>
|>>---------------------------------------------------------------------
|>>To unsubscribe, e-mail: [EMAIL PROTECTED]
|>>For additional commands, e-mail: [EMAIL PROTECTED]
|>>
|>>
|>
|>--
|>Kenney Westerhof
|>http://www.neonics.com
|>GPG public key: http://www.gods.nl/~forge/kenneyw.key
|>
|>---------------------------------------------------------------------
|>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)
iD8DBQFDDMqEK3h2CZwO/4URAp42AJ9Zzk5jbQtWStXNlTX6UPZztxf3yACfWlaf
tSzvsHb6CfBP9SQB8ZIOf1M=
=IdwA
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]