diff --git a/src/main/java/org/codehaus/mojo/exec/ExecMojo.java b/src/main/java/org/codehaus/mojo/exec/ExecMojo.java index 6641c6fe..9acf1b69 100644 --- a/src/main/java/org/codehaus/mojo/exec/ExecMojo.java +++ b/src/main/java/org/codehaus/mojo/exec/ExecMojo.java @@ -485,7 +485,7 @@ private void handleArguments( List 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 ) ); } @@ -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 )