Arguments file is created despite of a failed compile
-----------------------------------------------------
Key: MASPECTJ-78
URL: http://jira.codehaus.org/browse/MASPECTJ-78
Project: Mojo AspectJ Plugin
Issue Type: Bug
Affects Versions: 1.3
Reporter: Torsten Juergeleit
In {{AbstractAjcCompiler.execute()}} the ajc arguments file is created before
ajc is called. This argument file is used in
{{AbstractAjcCompiler.isBuildNeeded()}} to check if calling ajc should be
skipped if this arguments file already exists and holding the same same ajc
arguments.
This design will break if using this mojo in an CI build environment where the
mojo is executed multiple times (without changing the aspects source code) and
the ajc compile fails (due to errors in the aspects source code). In this case
only the first build reports the ajc compile errors but the following builds
will skip ajc due to the existance of the ajc argument file.
This can easily fixed by creating the ajc argument file AFTER ajc was executed
without any compile error, e.g.
{code}
getLog().debug( "Compiling and weaving " + resolvedIncludes.size() + " sources
to " + getOutputDirectories().get( 0 ) );
Main main = new Main();
MavenMessageHandler mavenMessageHandler = new MavenMessageHandler( getLog() );
main.setHolder( mavenMessageHandler );
main.runMain( (String[]) ajcOptions.toArray( new String[0] ), false );
IMessage[] errors = mavenMessageHandler.getMessages( IMessage.ERROR, true );
if ( errors.length == 0 ) {
try
{
File outDir = new File( (String) getOutputDirectories().get( 0 ) );
AjcHelper.writeBuildConfigToFile( ajcOptions, argumentFileName, outDir
);
getLog().debug(
"Argumentsfile written : "
+ new File( outDir.getAbsolutePath() +
argumentFileName ).getAbsolutePath() );
}
catch ( IOException e )
{
throw new MojoExecutionException( "Could not write arguments file to
the target area", e );
}
} else {
if ( !proceedOnError )
{
throw new CompilationFailedException( errors );
}
}
{code}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email