diff --git a/pom.xml b/pom.xml index a2f0b9c4..017cbbe9 100644 --- a/pom.xml +++ b/pom.xml @@ -68,7 +68,7 @@ under the License. ! The following property is used in the integration tests MCOMPILER-157 --> 3.5 - 2.12.1 + 2.13.0 2.4.21 3.7.0 diff --git a/src/it/MCOMPILER-192/verify.groovy b/src/it/MCOMPILER-192/verify.groovy index 0bdd307e..4e6e3b0a 100644 --- a/src/it/MCOMPILER-192/verify.groovy +++ b/src/it/MCOMPILER-192/verify.groovy @@ -23,7 +23,7 @@ assert logFile.exists() def content = logFile.getText('UTF-8') def causedByExpected = content.contains ( 'Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure' ) -def twoFilesBeingCompiled = content.contains ( '[INFO] Compiling 2 source files to ' ) +def twoFilesBeingCompiled = content.contains ( '[INFO] Compiling 2 source files with javac ' ) def checkResult = content.contains ( '[INFO] BUILD FAILURE' ) def compilationFailure1 = content.contains( '[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:') diff --git a/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java b/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java index ea37a4d5..8da9213b 100644 --- a/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java +++ b/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java @@ -70,10 +70,8 @@ import org.apache.maven.toolchain.ToolchainManager; import org.codehaus.plexus.compiler.Compiler; import org.codehaus.plexus.compiler.CompilerConfiguration; -import org.codehaus.plexus.compiler.CompilerError; import org.codehaus.plexus.compiler.CompilerException; import org.codehaus.plexus.compiler.CompilerMessage; -import org.codehaus.plexus.compiler.CompilerNotImplementedException; import org.codehaus.plexus.compiler.CompilerOutputStyle; import org.codehaus.plexus.compiler.CompilerResult; import org.codehaus.plexus.compiler.manager.CompilerManager; @@ -1255,15 +1253,7 @@ else if ( !values[0].equals( descriptor.name() ) ) try { - try - { - compilerResult = compiler.performCompile( compilerConfiguration ); - } - catch ( CompilerNotImplementedException cnie ) - { - List messages = compiler.compile( compilerConfiguration ); - compilerResult = convertToCompilerResult( messages ); - } + compilerResult = compiler.performCompile( compilerConfiguration ); } catch ( Exception e ) { @@ -1472,29 +1462,6 @@ protected boolean isTestCompile() return false; } - protected CompilerResult convertToCompilerResult( List compilerErrors ) - { - if ( compilerErrors == null ) - { - return new CompilerResult(); - } - List messages = new ArrayList<>( compilerErrors.size() ); - boolean success = true; - for ( CompilerError compilerError : compilerErrors ) - { - messages.add( - new CompilerMessage( compilerError.getFile(), compilerError.getKind(), compilerError.getStartLine(), - compilerError.getStartColumn(), compilerError.getEndLine(), - compilerError.getEndColumn(), compilerError.getMessage() ) ); - if ( compilerError.isError() ) - { - success = false; - } - } - - return new CompilerResult( success, messages ); - } - /** * @return all source files for the compiler */ diff --git a/src/test/java/org/apache/maven/plugin/compiler/stubs/CompilerStub.java b/src/test/java/org/apache/maven/plugin/compiler/stubs/CompilerStub.java index fd94cc24..23eb392a 100644 --- a/src/test/java/org/apache/maven/plugin/compiler/stubs/CompilerStub.java +++ b/src/test/java/org/apache/maven/plugin/compiler/stubs/CompilerStub.java @@ -20,7 +20,6 @@ */ import org.codehaus.plexus.compiler.CompilerConfiguration; -import org.codehaus.plexus.compiler.CompilerError; import org.codehaus.plexus.compiler.CompilerException; import org.codehaus.plexus.compiler.CompilerMessage; import org.codehaus.plexus.compiler.CompilerOutputStyle; @@ -29,7 +28,6 @@ import java.io.File; import java.io.IOException; import java.util.Collections; -import java.util.List; /** * @author Edwin Punzalan @@ -74,29 +72,6 @@ public boolean canUpdateTarget( CompilerConfiguration compilerConfiguration ) return false; } - public List compile( CompilerConfiguration compilerConfiguration ) - throws CompilerException - { - File outputDir = new File( compilerConfiguration.getOutputLocation() ); - - try - { - outputDir.mkdirs(); - - File outputFile = new File( outputDir, "compiled.class" ); - if ( !outputFile.exists() && !outputFile.createNewFile() ) - { - throw new CompilerException( "could not create output file: " + outputFile.getAbsolutePath() ); - } - } - catch ( IOException e ) - { - throw new CompilerException( "An exception occurred while creating output file", e ); - } - - return Collections.singletonList( new CompilerError( "message 1", shouldFail ) ); - } - public CompilerResult performCompile( CompilerConfiguration compilerConfiguration ) throws CompilerException {