Hello Guillaume

I tested RC-5 with the compiler plugin. In the JUnit tests, mocks are created like below (example from CompilerMojoTestCase.java line 128):

   @Test
   @Basedir("${basedir}/target/test-classes/unit/compiler-basic-test")
   public void testCompilerBasic(
            @InjectMojo(goal = "compile", pom = "plugin-config.xml") 
CompilerMojo compileMojo,
            @InjectMojo(goal = "testCompile", pom = "plugin-config.xml")
                    @MojoParameter(name = "compileSourceRoots", value = 
"${project.basedir}/src/test/java")
                    TestCompilerMojo testCompileMojo) {

With Maven 4.0.0-rc-4, the AbstractCompilerMojo.compileSourceRoots field is correctly initialized to the "${project.basedir}/src/test/java" value during compilation of tests. But with Maven 4.0.0-rc-5, the field is non-null only for the main goal and is null for the test goal, causing the JUnit tests to fail. Is it a regression, or does the parameter needs to be defined otherwise?

The issue can be reproduced as below:

 * Checkout the master branch of Maven Compiler Plugin
   (c3fc26a31d1a7dc3d98cb3d3769de32306467741).
 * In the pom.xml at line 85, change 4.0.0-rc-4 to 4.0.0-rc-5. Add the
   staging repository.
 * In AbstractCompilerMojo, put break points on lines 1059 and 1062
   (the two branches of a if - else).
 * Run CompilerMojoTestCase in a debugger.

The debugger should never hit the break point at line 1059 (the case when compileSourceRoots is absent). This is verified with RC-4. But with RC-5, it seems to be the case for every tests.

    Martin

Reply via email to