Skip to content

Commit

Permalink
FORGE-1912: Maven native now uses the setting set in the system prop
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi committed Jun 27, 2014
1 parent 6d50651 commit caec860
Showing 1 changed file with 21 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -252,22 +252,39 @@ public boolean executeMaven(final String[] selected)
return executeMaven(System.out, selected);
}

public boolean executeMaven(final OutputStream out, final String[] parms)
public boolean executeMaven(final OutputStream out, final String[] arguments)
{
List<String> list = new ArrayList<>();
// FORGE-1912: Maven settings are not being set in embedded maven
if (System.getProperty(MavenContainer.ALT_USER_SETTINGS_XML_LOCATION) != null)
{
list.add("-s");
list.add(System.getProperty(MavenContainer.ALT_USER_SETTINGS_XML_LOCATION));
}
else if (System.getProperty(MavenContainer.ALT_GLOBAL_SETTINGS_XML_LOCATION) != null)
{
list.add("-s");
list.add(System.getProperty(MavenContainer.ALT_GLOBAL_SETTINGS_XML_LOCATION));
}
if (arguments != null)
{
list.addAll(Arrays.asList(arguments));
}
String[] params = list.toArray(new String[list.size()]);
try
{
DirectoryResource directory = getFaceted().getRoot().reify(DirectoryResource.class);
if (directory == null)
throw new IllegalStateException("Cannot execute maven build on resources that are not File-based.");
int returnValue = NativeSystemCall.execFromPath(getMvnCommand(), parms, out, directory);
int returnValue = NativeSystemCall.execFromPath(getMvnCommand(), params, out, directory);
if (returnValue == 0)
return true;
else
return executeMavenEmbedded(parms);
return executeMavenEmbedded(params);
}
catch (IOException e)
{
return executeMavenEmbedded(parms);
return executeMavenEmbedded(params);
}
}

Expand Down

0 comments on commit caec860

Please sign in to comment.