Skip to content

Commit

Permalink
mojohaus#75 Supporting module path given as string
Browse files Browse the repository at this point in the history
  • Loading branch information
gunnarmorling committed Mar 17, 2018
1 parent ce25aac commit a83bc8d
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/main/java/org/codehaus/mojo/exec/ExecMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ private void handleArguments( List<String> commandArguments )
String filePath = new File(buildDir, "modulepath").getAbsolutePath();
commandArguments.add( '@' + filePath );

String modulePath = StringUtils.join( computePath( (Modulepath) arguments.get( ++i ) ).iterator(), File.pathSeparator );
String modulePath = getModulePath(arguments.get( ++i ));

createArgFile( filePath, Arrays.asList( "-p", modulePath ) );
}
Expand All @@ -510,6 +510,21 @@ else if ( argument instanceof Modulepath )
}
}

/**
* Builds a module path string from the given argument.
*/
private String getModulePath(Object modulePathArg) throws MojoExecutionException {
if ( modulePathArg instanceof Modulepath ) {
return StringUtils.join( computePath( (Modulepath) modulePathArg ).iterator(), File.pathSeparator );
}
else if ( modulePathArg instanceof String ) {
return (String) modulePathArg;
}
else {
throw new MojoExecutionException( "Value of unsupported type for modulepath argument: "+ modulePathArg );
}
}

private void fillSuccessCodes( Executor exec )
{
if ( successCodes != null && successCodes.length > 0 )
Expand Down

0 comments on commit a83bc8d

Please sign in to comment.