Resolving http://jira.codehaus.org/browse/MNG-710: "Add ability to fork the

maven-compiler-plugin".
o Applying Rod Coffin's patch. Removed the basedir as a configurable argument.


git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@230869 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Trygve Laugstol 2005-08-08 19:58:32 +00:00
parent 2823fe4711
commit daba7dca27
1 changed files with 46 additions and 3 deletions

View File

@ -92,6 +92,41 @@ public abstract class AbstractCompilerMojo
*/
private String compilerId;
/**
* Runs the compiler in a separate process.
*
* If not set the compiler will default to a executable.
*
* @parameter default-value="false"
*/
private boolean fork;
/**
* The executable of the compiler to use.
*
* @parameter
*/
private String executable;
/**
* Arguements to be passed to the compiler if fork is set to true.
*
* This is because the list of valid arguements passed to a Java compiler
* varies based on the compiler version.
*
* @parameter
*/
private List compilerArguements;
/**
* The directory to run the compiler from if fork is true.
*
* @parameter expression="${basedir}"
* @required
* @readonly
*/
private File basedir;
/**
* @parameter expression="${component.org.codehaus.plexus.compiler.manager.CompilerManager}"
* @required
@ -137,6 +172,7 @@ public abstract class AbstractCompilerMojo
if ( staleSources.isEmpty() )
{
getLog().info( "Nothing to compile - all classes are up to date" );
return;
}
else
@ -156,6 +192,14 @@ public abstract class AbstractCompilerMojo
compilerConfiguration.setSourceEncoding( encoding );
compilerConfiguration.setFork( fork );
compilerConfiguration.setExecutable( executable );
compilerConfiguration.setWorkingDirectory( basedir );
compilerConfiguration.setCompilerArguements( compilerArguements );
// ----------------------------------------------------------------------
// Dump configuration
// ----------------------------------------------------------------------
@ -256,8 +300,8 @@ public abstract class AbstractCompilerMojo
}
catch ( InclusionScanException e )
{
throw new MojoExecutionException( "Error scanning source root: \'" + sourceRoot
+ "\' for stale files to recompile.", e );
throw new MojoExecutionException( "Error scanning source root: \'" + sourceRoot + "\' " +
"for stale files to recompile.", e );
}
}
@ -285,5 +329,4 @@ public abstract class AbstractCompilerMojo
}
return newCompileSourceRootsList;
}
}