On Wed, 24 Aug 2005, Chris Berry wrote:
> > 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.
>
> Don't we already have this?? I have dependencies defined for my plugin
> and they are all there when I call my Ant tasks (using an extended
> version of AbstractAntMojo). I have verified this.
The difference is that the project USING the plugin can define jars that
are included in the _plugin_ classpath ONLY. So you could for instance
enhance the antrun plugin with regexp filemappers by including
jakarta-regexp there. Right now the xdoclet plugin (using the antrun
plugin) has to define ALL xdoclet jars (xdoclet modules), so that any user
can use any ejb doclet task. However, there are a lot of them and most are
not used, so I'd like to only include the core libs (xjavadoc, xdoclet
'core' and some core deps). But that's just one usecase.
[snip on plugin.getArtifactMap]
> Unfortunately, this doesn't really work in my case. Say I have an Ant
> build file named "axis.xml" and I bundle this into my Plugin JAR. I
> cannot access this as a File. Yes, it has a path in the URL sense (i.e
> jar:/...) But Ant wants a regular old file that I can get an absolute
> path to. (BTW: Ant is just an example. The same could hold true for
> many other situations)
So you're building a mojo that executes a built-in build.xml file?
Why don't you hardcode the tasks in the mojo?
Another solution is to run that file using the ant api to parse it:
System.setProperty(
"org.apache.tools.ant.ProjectHelper",
"org.apache.tools.ant.helper.ProjectHelper2" // this one has URL support
);
Project proj = new Project(); // plus some initialization
ProjectHelper.getProjectHelper().parse( project, buildfileUrl );
If you use the 'ant' task (or subant..?) you can't let it inherit
everything - the properties are resolved using reflection on the
MavenProject etc., and the inheritance mechanism copies all properties to
the child ant 'process', but as each property is evaluated at runtime,
there's no list to copy.
>
> Is there any way to bundle files (such as axis.xml) into the
> repository -- such that I could access it directly as,say,
> ${localRepository}/blah/plugins/axis-plugin/1.0-SNAPSHOT/axis.xml
Nope. The fact that ant can't handle URL's is ant's fault - it could just
as easily work with URLs instead of files.. ;)
> Of course, I could unjar the Plugin into /target -- but that seems
> like a hack...
It's not forbidden to make workarounds to use 3rd party libs..
You could use getResource() to get the url of the axis.xml,
and store just that file in target/...
> Thanks for all your help & insight,
You too :)
Btw, could you send me a patch (or create a JIRA and attach it) for your
fix on making <echo> work? The only solution I saw was to set the 'stdout'
stream to System.err..
-- Kenney
> Cheers,
> -- 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]