Hi,
be aware that a Request/Result are pojo's: just a number of getters and
setters.
This is done to have control over the number of arguments. Now we can call
on a Invoker instance:
InvocationResult execute( InvocationRequest request )
If we need more 'arguments', we'll add it to the request, while the method
signature stays the same.
1. Here's the Javadoc for InvokerRequest.getProfiles():
/**
* Gets the profiles for the Maven invocation.
*
* @return The profiles for the Maven invocation or <code>null</code> if
not set.
*/
List<String> getProfiles();
So this will contain the arguments which you pass as -P profile1
2. Use Invoker.setWorkingDirectory( File workingDirectory );
Check http://maven.apache.org/shared/maven-invoker/usage.html for more
details.
Robert
Op Fri, 23 Aug 2013 05:37:49 +0200 schreef Mark Eggers
<[email protected]>:
Maybe I'm just not thinking the Maven way . . .
My ultimate goal is to create a web form driven application that allows
some slight customization of another web application delivered as a WAR
file. The bulk of that application consists of a WAR overlay, and the
user ends up creating two files to add to that overlay.
I can do this by hand, and all works as expected.
In order to start out with this, I thought I would write a small program
to create an artifact and then build it.
I'm using maven invoker and that seems to do what I need, except I'm
unable to do two things.
1. read profiles
InvocationRequest request = new DefaultInvocationRequest();
List<String> profiles = request.getProfiles(); // profiles is null
I have some profiles in ~.m2/settings.xml, and one is set active since
it controls all my proxy settings.
2. Specify directories
I would like to specify the directory where archetype:generate is run,
and I would like to specify where the target gets placed. I would
happily settle for the first, since I know that the resulting WAR file
will be in target.
I'm running this against Maven 3.1 with JDK 1.7.0_25 on Windows at the
moment. The target system will be running Linux, but it's Maven so that
shouldn't matter.
I've tried (rather naively) to set the basedir property by loading a
Properties object into the request, but that seemed to have no effect.
I was hoping to set the build directory in a profile, but I don't seem
to be reading profiles.
Input (including don't do this admonitions) happily taken.
. . . . just my two cents.
/mde/
---------------------------------------------------------------------
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]