summaryrefslogtreecommitdiff
path: root/src/main/java/org/apache
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/apache')
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/Javah.java3
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarUtil.java58
2 files changed, 33 insertions, 28 deletions
diff --git a/src/main/java/org/apache/maven/plugin/nar/Javah.java b/src/main/java/org/apache/maven/plugin/nar/Javah.java
index f297416..da104e6 100644
--- a/src/main/java/org/apache/maven/plugin/nar/Javah.java
+++ b/src/main/java/org/apache/maven/plugin/nar/Javah.java
@@ -33,6 +33,7 @@ import org.apache.bcel.classfile.Method;
import org.apache.maven.artifact.DependencyResolutionRequiredException;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.toolchain.Toolchain;
import org.codehaus.plexus.compiler.util.scan.InclusionScanException;
import org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner;
import org.codehaus.plexus.compiler.util.scan.StaleSourceScanner;
@@ -236,7 +237,7 @@ public class Javah
File javahFile = new File( mojo.getJavaHome( mojo.getAOL() ), "bin" );
String javah = new File(javahFile, name).getAbsolutePath();
-
+
mojo.getLog().info( "Running " + javah + " compiler on " + files.size() + " classes..." );
int result = NarUtil.runCommand( javah, generateArgs( files ), null, null, mojo.getLog() );
if ( result != 0 )
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarUtil.java b/src/main/java/org/apache/maven/plugin/nar/NarUtil.java
index 4aad1fe..7e45013 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarUtil.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarUtil.java
@@ -412,38 +412,40 @@ public class NarUtil
public static int runCommand( String cmd, String[] args, File workingDirectory, String[] env, Log log )
throws MojoExecutionException, MojoFailureException
{
- log.debug( "RunCommand: " + cmd );
NarCommandLine cmdLine = new NarCommandLine();
- cmdLine.setExecutable( cmd );
- if ( args != null )
+
+ try
{
- for ( int i = 0; i < args.length; i++ )
+ cmd = CommandLineUtils.quote( cmd );
+ log.debug( "RunCommand: " + cmd );
+ cmdLine.setExecutable( cmd );
+ if ( args != null )
{
- log.debug( " '" + args[i] + "'" );
+ for ( int i = 0; i < args.length; i++ )
+ {
+ log.debug( " '" + args[i] + "'" );
+ }
+ cmdLine.addArguments( args );
+ }
+ if ( workingDirectory != null )
+ {
+ log.debug( "in: " + workingDirectory.getPath() );
+ cmdLine.setWorkingDirectory( workingDirectory );
}
- cmdLine.addArguments( args );
- }
- if ( workingDirectory != null )
- {
- log.debug( "in: " + workingDirectory.getPath() );
- cmdLine.setWorkingDirectory( workingDirectory );
- }
- if ( env != null )
- {
- log.debug( "with Env:" );
- for ( int i = 0; i < env.length; i++ )
+ if ( env != null )
{
- String[] nameValue = env[i].split( "=", 2 );
- if ( nameValue.length < 2 )
- throw new MojoFailureException( " Misformed env: '" + env[i] + "'" );
- log.debug( " '" + nameValue[0] + "=" + nameValue[1] + "'" );
- cmdLine.addEnvironment( nameValue[0], nameValue[1] );
+ log.debug( "with Env:" );
+ for ( int i = 0; i < env.length; i++ )
+ {
+ String[] nameValue = env[i].split( "=", 2 );
+ if ( nameValue.length < 2 )
+ throw new MojoFailureException( " Misformed env: '" + env[i] + "'" );
+ log.debug( " '" + nameValue[0] + "=" + nameValue[1] + "'" );
+ cmdLine.addEnvironment( nameValue[0], nameValue[1] );
+ }
}
- }
- try
- {
Process process = cmdLine.execute();
StreamGobbler errorGobbler = new StreamGobbler( process.getErrorStream(), true, log );
StreamGobbler outputGobbler = new StreamGobbler( process.getInputStream(), false, log );
@@ -487,10 +489,12 @@ public class NarUtil
return (String[]) envVars.toArray( new String[envVars.size()] );
}
}
-
- private Vector getSystemEnvironment() throws IOException {
+
+ private Vector getSystemEnvironment()
+ throws IOException
+ {
Properties envVars = CommandLineUtils.getSystemEnvVars();
- Vector systemEnvVars = new Vector(envVars.size());
+ Vector systemEnvVars = new Vector( envVars.size() );
for ( Iterator i = envVars.keySet().iterator(); i.hasNext(); )
{