From e6e4bcb924740c287edd25b3c96e629d652047b8 Mon Sep 17 00:00:00 2001 From: rfscholte Date: Mon, 4 Mar 2019 21:37:59 +0100 Subject: [PATCH] Resolving "target" dir via "${project.build.directory}", so to make sure it can be resolved correctly within multi-module builds and if another name than "target" has been configured This fixes #98 --- .../java/org/codehaus/mojo/exec/ExecMojo.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/codehaus/mojo/exec/ExecMojo.java b/src/main/java/org/codehaus/mojo/exec/ExecMojo.java index 6dfd79a5..ead705a5 100644 --- a/src/main/java/org/codehaus/mojo/exec/ExecMojo.java +++ b/src/main/java/org/codehaus/mojo/exec/ExecMojo.java @@ -148,6 +148,12 @@ public class ExecMojo */ @Parameter( readonly = true, required = true, defaultValue = "${basedir}" ) private File basedir; + + /** + * @since 3.0.0 + */ + @Parameter( readonly = true, required = true, defaultValue = "${project.build.directory}" ) + private File buildDirectory; /** *

Environment variables to pass to the executed program. For example if you want to set the LANG var: @@ -482,10 +488,10 @@ private void handleArguments( List commandArguments ) } else if ( argument instanceof String && isLongModulePathArgument( (String) argument ) ) { - String filePath = "target/modulepath"; - + String filePath = new File( buildDirectory, "modulepath" ).getAbsolutePath(); + commandArguments.add( '@' + filePath ); - + StringBuilder modulePath = new StringBuilder(); modulePath.append( '"' ); @@ -499,7 +505,7 @@ else if ( argument instanceof String && isLongModulePathArgument( (String) argum } modulePath.append( '"' ); - + createArgFile( filePath, Arrays.asList( "-p", modulePath.toString() ) ); } else if ( argument instanceof Classpath ) @@ -512,7 +518,7 @@ else if ( argument instanceof Classpath ) else if ( argument instanceof Modulepath ) { Modulepath specifiedModulepath = (Modulepath) argument; - + arg = computeClasspathString( specifiedModulepath ); commandArguments.add( arg ); }