[
https://jira.codehaus.org/browse/MINVOKER-155?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=325421#comment-325421
]
Laura Llewellyn commented on MINVOKER-155:
------------------------------------------
Originally asked on the [Maven user's
group|http://mail-archives.apache.org/mod_mbox/maven-users/201305.mbox/%3CCAMFVGuSrgYVbWhyo1oKb%2B5otX55YNLcj9%2BjKe4B%3DTUnmEdeThg%40mail.gmail.com%3E].
I'm reporting as a bug at Stephen Connolly's request. Attached test case
includes the POM with invoker plugin configuration and an integration test that
verifies the environment variables specified in the plugin configuration are
defined.
I looked at the source code for the maven-invoker-plugin and the shared
Invoker component. The AbstractInvokerMojo.runBuild method has this code:
{code}
final InvocationRequest request = new DefaultInvocationRequest();
....
if ( environmentVariables != null )
{
for ( Map.Entry<String, String> variable : environmentVariables.entrySet() )
{
request.addShellEnvironment( variable.getKey(), variable.getValue());
}
}
{code}
InvocationRequest is in the [shared Invoker plugin
code|http://svn.apache.org/viewvc/maven/shared/tags/maven-invoker-2.1.1/src/main/java/org/apache/maven/shared/invoker/DefaultInvocationRequest.java?view=markup].
The addShellEnvironment method:
{code}
public InvocationRequest addShellEnvironment( String name, String value )
{
if ( this.shellEnvironmentInherited )
{
this.shellEnvironments = new HashMap<String, String>();
}
this.shellEnvironments.put( name, value );
return this;
}
{code}
{{shellEnvironmentInherited}} is true by default, and I didn't see the Invoker
plugin setting it to false. It looks to me like a new HashMap is being created
every time this method is called, meaning only one shell environment var may be
added.
> Invoker plugin does not allow multiple environment variables to be set
> ----------------------------------------------------------------------
>
> Key: MINVOKER-155
> URL: https://jira.codehaus.org/browse/MINVOKER-155
> Project: Maven 2.x Invoker Plugin
> Issue Type: Bug
> Affects Versions: 1.8
> Environment: Observed with Maven 3.0.4, both Windows 7 and RedHat
> Linux
> Reporter: Laura Llewellyn
> Assignee: Robert Scholte
> Attachments: maven-env-test.zip
>
>
> Multiple environment variables may be specified using the
> {{environmentVariables}} parameter as shown below. However, only one of the
> variables is actually passed to the test cases.
> {code:title=Plugin Configuration}
> <environmentVariables>
> <A_PROP>white</A_PROP>
> <Z_PROP>blue</Z_PROP>
> </environmentVariables>
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira