You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Julian Scheid <ju...@sektor37.de> on 2004/06/28 05:45:13 UTC

Self-dependent plugin

Hello Maven friends,

I have some questions about the Maven plugin system which require a
bit of context, please bear with me for a minute.

I have recently written a Java code generator which meanwhile is
self-hosting, that is: part of the code generator's code is generated
by itself. This makes the project quiet special in that it is
self-dependent.

That's not a bug, but actually a feature  - the recent switch to
self-generated code simplified the sources considerably, removing
redundancies - thus making it more maintainable - and, as a welcome
side effect, making the system a test case for itself.

Self-dependency implies that in order to build the generator, the
generator must already exist, a dilemma which I solve like everyone
else by providing binaries. Since it's Java and the binary is quiet
small I can just include a precompiled .jar in the source code
distribution for use during the build. That's fine and all.

I also wrote an Ant task for the code generator, and again I'm using
it "recursively" in the script used for building the system, including
the Ant task itself. That's possible because Ant provides the
<taskdef/> mechanism for adding a Task on-the-fly (loading it from the
precompiled .jar) before the task is "officially" built and installed.

Now, I plan to create a Maven plugin next and switch to Maven for
building, and I want to again "recursively" use this Maven plugin for
building "itself" - that is, the system including the Maven plugin.
Everything else would mean redundancy.

My problem is that I can't figure out how to add the precompiled
plugin to Maven on-the-fly, at build time - before the freshly
compiled plugin gets installed.

I noticed the maven.plugin.dir property, but since I need other
plugins as well and this is a ".dir" and not a ".path", I don't want
to tinker with it.

I would also like to avoid XML inclusion hacks (like "symlinking" the
plugin's goals into maven.xml) but instead go with a standard Maven
plugin, just as I go with a standard Ant task now.

In addition, I'd dislike any approach that involves temporarily
installing the plugin outside of the build directory (the Maven
developer guide mentions something about copying the plugin tree
during development.) A build process is not supposed to modify the
system environment after all, even if it's a temporary change.

So my question would be, is there any other way to register the
precompiled plugin with Maven temporarily? Perhaps some Java method
I could call using Jelly, announcing the temporary root of the
not-yet-installed plugin, and ideally allowing me to set its
classpath to the precompiled .jar as well?

In general, what do Maven experts think: is the Maven architecture
prepared for self-dependent projects like this, or should I better
stick to the lower-level approach, Ant, for this particular kind of
project?

Thanks for your time and consideration,

Julian



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org