diff --git a/src/it/setup_annotation-verify-plugin/src/main/java/org.apache.maven.plugins.compiler.it/SourcePathReadGoal.java b/src/it/setup_annotation-verify-plugin/src/main/java/org.apache.maven.plugins.compiler.it/SourcePathReadGoal.java index 46b7d2b6..d3691fa2 100644 --- a/src/it/setup_annotation-verify-plugin/src/main/java/org.apache.maven.plugins.compiler.it/SourcePathReadGoal.java +++ b/src/it/setup_annotation-verify-plugin/src/main/java/org.apache.maven.plugins.compiler.it/SourcePathReadGoal.java @@ -47,12 +47,17 @@ public class SourcePathReadGoal extends AbstractMojo { public void execute() throws MojoExecutionException, MojoFailureException { if (sourceClass != null) { getLog().info("Checking compile source roots for: '" + sourceClass + "'"); - assertGeneratedSourceFileFor(sourceClass, project.getCompileSourceRoots()); + List roots = project.getCompileSourceRoots(); + roots.add(project.getModel().getBuild().getOutputDirectory() + "/../generated-sources/annotations"); + assertGeneratedSourceFileFor(sourceClass, roots); } if (testSourceClass != null) { getLog().info("Checking test-compile source roots for: '" + testSourceClass + "'"); - assertGeneratedSourceFileFor(testSourceClass, project.getTestCompileSourceRoots()); + List roots = project.getTestCompileSourceRoots(); + roots.add( + project.getModel().getBuild().getOutputDirectory() + "/../generated-test-sources/test-annotations"); + assertGeneratedSourceFileFor(testSourceClass, roots); } } 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 2229dd8b..9b63153a 100644 --- a/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java +++ b/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java @@ -821,28 +821,6 @@ public void execute() throws MojoExecutionException, CompilationFailureException if (!generatedSourcesDirectory.exists()) { generatedSourcesDirectory.mkdirs(); } - - String generatedSourcesPath = generatedSourcesDirectory.getAbsolutePath(); - - compileSourceRoots.add(generatedSourcesPath); - - if (isTestCompile()) { - getLog().debug("Adding " + generatedSourcesPath + " to test-compile source roots:\n " - + StringUtils.join(project.getTestCompileSourceRoots().iterator(), "\n ")); - - project.addTestCompileSourceRoot(generatedSourcesPath); - - getLog().debug("New test-compile source roots:\n " - + StringUtils.join(project.getTestCompileSourceRoots().iterator(), "\n ")); - } else { - getLog().debug("Adding " + generatedSourcesPath + " to compile source roots:\n " - + StringUtils.join(project.getCompileSourceRoots().iterator(), "\n ")); - - project.addCompileSourceRoot(generatedSourcesPath); - - getLog().debug("New compile source roots:\n " - + StringUtils.join(project.getCompileSourceRoots().iterator(), "\n ")); - } } compilerConfiguration.setSourceLocations(compileSourceRoots);