[EMAIL PROTECTED] wrote:
Hi
I have been giving this some thought, and I am wondering if this behaviour is by design (Committers: feel free to chip in here).
If you execute a mojo from a commandline, it takes effect from the current
directory. There is no parameter/command line switch to direct it to another
working directory.
Now you might start to wonder: What is the use of the setBaseDir of DefaultMavenExecutionRequest ?
As far as I can tell, the only reference to the base directory is in
DefaultEventMonitor, which does logging.
Since there is no way you can change the working directory in java (i.e can't
chdir), in order for this to work from a programatical way, the
archetype:create mojo needs to be augmented with baseDir property which it will
then use when it creates the project.
It should definitely be possible to do, the problem here is that the
archetype doesn't use the basedir parameter. I wrote another mail about
this earlier today but I seem to be loosing some outgoing mail today.
As you might know plugins should be able to run multi-module build just
fine, they just have to use the basedir as a prefix for all paths.
By fixing the archetype Mojo[1] so that it uses the basedir everything
should work for you.
Add a parameter like this:
/**
* @parameter expression="${basedir}"
*/
String basedir;
and remove the basedir variable inside the class.
[1]:
https://svn.apache.org/repos/asf/maven/archetype/trunk/maven-archetype/maven-archetype-plugin/src/main/java/org/apache/maven/plugin/archetype/MavenArchetypeMojo.java
--
Trygve
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]