You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "mensinda (via GitHub)" <gi...@apache.org> on 2023/06/15 08:01:31 UTC

[GitHub] [maven-compiler-plugin] mensinda opened a new pull request, #191: MCOMPILER-538: Do not add target/generated-sources/annotations to the source roots

mensinda opened a new pull request, #191:
URL: https://github.com/apache/maven-compiler-plugin/pull/191

   Fix for [MCOMPILER-538](https://issues.apache.org/jira/browse/MCOMPILER-538).
   
   The `generatedSourcesPath` will still be added to the *maven* project paths.
   
   ---
   
   Following this checklist to help us incorporate your 
   contribution quickly and easily:
   
    - [x] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/MCOMPILER) filed 
          for the change (usually before you start working on it).  Trivial changes like typos do not 
          require a JIRA issue.  Your pull request should address just this issue, without 
          pulling in other changes.
    - [x] Each commit in the pull request should have a meaningful subject line and body.
    - [x] Format the pull request title like `[MCOMPILER-XXX] - Fixes bug in ApproximateQuantiles`,
          where you replace `MCOMPILER-XXX` with the appropriate JIRA issue. Best practice
          is to use the JIRA issue title in the pull request title and in the first line of the 
          commit message.
    - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
    - [x] Run `mvn clean verify` to make sure basic checks pass. A more thorough check will 
          be performed on your pull request automatically.
    - [x] You have run the integration tests successfully (`mvn -Prun-its clean verify`).
   
   If your pull request is about ~20 lines of code you don't need to sign an
   [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf) if you are unsure
   please ask on the developers list.
   
   To make clear that you license your contribution under 
   the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   you have to acknowledge this by using the following check-box.
   
    - [x] I hereby declare this contribution to be licenced under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   
    - [x] In any other case, please file an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [MCOMPILER-538] Do not add target/generated-sources/annotations to the source roots [maven-compiler-plugin]

Posted by "mensinda (via GitHub)" <gi...@apache.org>.
mensinda commented on PR #191:
URL: https://github.com/apache/maven-compiler-plugin/pull/191#issuecomment-2668650940

   @elharo I did that and there are no changes:
   
   `mvn spotless:apply`:
   
   ```
   [INFO] Scanning for projects...
   [INFO]
   [INFO] -----------< org.apache.maven.plugins:maven-compiler-plugin >-----------
   [INFO] Building Apache Maven Compiler Plugin 3.14.1-SNAPSHOT
   [INFO]   from pom.xml
   [INFO] ----------------------------[ maven-plugin ]----------------------------
   [INFO]
   [INFO] --- spotless:2.43.0:apply (default-cli) @ maven-compiler-plugin ---
   [INFO] Spotless.Java is keeping 282 files clean - 0 were changed to be clean, 0 were already clean, 282 were skipped because caching determined they were already clean
   [INFO] Spotless.Pom is keeping 1 files clean - 0 were changed to be clean, 0 were already clean, 1 were skipped because caching determined they were already clean
   [INFO] ------------------------------------------------------------------------
   [INFO] BUILD SUCCESS
   [INFO] ------------------------------------------------------------------------
   [INFO] Total time:  1.198 s
   [INFO] Finished at: 2025-02-19T14:22:35+01:00
   [INFO] ------------------------------------------------------------------------
   ```
   
   ---
   
   `git status`:
   
   ```
   On branch optionalGeneratedSources
   Your branch is up to date with 'origin/optionalGeneratedSources'.
   
   nothing to commit, working tree clean
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [MCOMPILER-538] Do not add target/generated-sources/annotations to the source roots [maven-compiler-plugin]

Posted by "mensinda (via GitHub)" <gi...@apache.org>.
mensinda commented on PR #191:
URL: https://github.com/apache/maven-compiler-plugin/pull/191#issuecomment-2670743506

   The current error is most likely because of the `copy-rename-maven-plugin` that I require for the IT to function.
   
   I have added `invoker.maven.version = 3.8.8+` to the properties to (hopefully) skip the test on the CIs with maven `3.6.3`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [MCOMPILER-538] Do not add target/generated-sources/annotations to the source roots [maven-compiler-plugin]

Posted by "mensinda (via GitHub)" <gi...@apache.org>.
mensinda commented on PR #191:
URL: https://github.com/apache/maven-compiler-plugin/pull/191#issuecomment-2713201054

   I did manage to add the path back in #311, but it feels hacky...
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [MCOMPILER-538] Do not add target/generated-sources/annotations to the source roots [maven-compiler-plugin]

Posted by "jorsol (via GitHub)" <gi...@apache.org>.
jorsol commented on PR #191:
URL: https://github.com/apache/maven-compiler-plugin/pull/191#issuecomment-1861913272

   I have been checking the javac options, and testing with this change, it does in fact seems that we don't need to specify the generated-sources/annotations in the -sourcepath argument, it should be more that enought to specify it on the -s option.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [MCOMPILER-538] Do not add target/generated-sources/annotations to the source roots [maven-compiler-plugin]

Posted by "mensinda (via GitHub)" <gi...@apache.org>.
mensinda commented on PR #191:
URL: https://github.com/apache/maven-compiler-plugin/pull/191#issuecomment-2671875731

   looks like the CI is green now.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [MCOMPILER-538] Do not add target/generated-sources/annotations to the source roots [maven-compiler-plugin]

Posted by "Nthalk (via GitHub)" <gi...@apache.org>.
Nthalk commented on PR #191:
URL: https://github.com/apache/maven-compiler-plugin/pull/191#issuecomment-1868143710

   > > All my projects that test upgrades to 3.12.0 fail because of this line, looking forward to when it's removed!
   > 
   > @Nthalk We need more details. There is a version 3.12.1 under vote, will be available in a few day. Please comments in JIRA
   
   I'm using renovate for auto dependency upgrades on multiple projects, the simplest doesn't use any annotation processing and yields this error on `mvn clean install`:
   
   ```
   [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.12.0:testCompile (default-testCompile) on project selenium-jquery: Fatal error compiling: basedir /home/iode-jenkins-agent/agent/workspace/IodeSystems_SeleniumJQuery_PR-69/target/generated-test-sources/test-annotations does not exist -> [Help 1]
   ```
   
   The configuration I have is pretty simple, no funny business:
   
   ```
   <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-compiler-plugin</artifactId>
           <version>3.11.0</version>
           <configuration>
             <source>21</source>
             <target>21</target>
             <showWarnings>true</showWarnings>
           </configuration>
         </plugin>
   ```
   
   Here is the output of `mvn clean install`
   
   ```
   [INFO] ------------------------------------------------------------------------
   [INFO] BUILD FAILURE
   [INFO] ------------------------------------------------------------------------
   [INFO] Total time:  4.853 s
   [INFO] Finished at: 2023-12-22T16:09:00-08:00
   [INFO] ------------------------------------------------------------------------
   [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.12.0:testCompile (default-testCompile) on project selenium-jquery: Fatal error compiling: basedir /Users/nthalk/local/src/iodesystems/SeleniumJQuery/target/generated-test-sources/test-annotations does not exist -> [Help 1]
   org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.12.0:testCompile (default-testCompile) on project selenium-jquery: Fatal error compiling
       at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:333)
       at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
       at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
       at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
       at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
       at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
       at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
       at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
       at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
       at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
       at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
       at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
       at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
       at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
       at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
       at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
       at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
       at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
       at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
       at java.lang.reflect.Method.invoke (Method.java:580)
       at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)
       at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
       at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
       at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)
       at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
       at java.lang.reflect.Method.invoke (Method.java:580)
       at org.apache.maven.wrapper.BootstrapMainStarter.start (BootstrapMainStarter.java:52)
       at org.apache.maven.wrapper.WrapperExecutor.execute (WrapperExecutor.java:161)
       at org.apache.maven.wrapper.MavenWrapperMain.main (MavenWrapperMain.java:73)
   Caused by: org.apache.maven.plugin.MojoExecutionException: Fatal error compiling
       at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute (AbstractCompilerMojo.java:1189)
       at org.apache.maven.plugin.compiler.TestCompilerMojo.execute (TestCompilerMojo.java:204)
       at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
       at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
       at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
       at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
       at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
       at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
       at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
       at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
       at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
       at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
       at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
       at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
       at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
       at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
       at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
       at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
       at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
       at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
       at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
       at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
       at java.lang.reflect.Method.invoke (Method.java:580)
       at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)
       at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
       at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
       at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)
       at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
       at java.lang.reflect.Method.invoke (Method.java:580)
       at org.apache.maven.wrapper.BootstrapMainStarter.start (BootstrapMainStarter.java:52)
       at org.apache.maven.wrapper.WrapperExecutor.execute (WrapperExecutor.java:161)
       at org.apache.maven.wrapper.MavenWrapperMain.main (MavenWrapperMain.java:73)
   Caused by: java.lang.IllegalStateException: basedir /Users/nthalk/local/src/iodesystems/SeleniumJQuery/target/generated-test-sources/test-annotations does not exist
       at org.codehaus.plexus.util.DirectoryScanner.scan (DirectoryScanner.java:268)
       at org.codehaus.plexus.compiler.AbstractCompiler.getSourceFilesForSourceRoot (AbstractCompiler.java:168)
       at org.codehaus.plexus.compiler.AbstractCompiler.getSourceFiles (AbstractCompiler.java:194)
       at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile (JavacCompiler.java:138)
       at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute (AbstractCompilerMojo.java:1186)
       at org.apache.maven.plugin.compiler.TestCompilerMojo.execute (TestCompilerMojo.java:204)
       at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
       at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
       at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
       at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
       at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
       at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
       at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
       at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
       at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
       at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
       at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
       at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
       at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
       at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
       at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
       at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
       at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
       at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
       at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
       at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
       at java.lang.reflect.Method.invoke (Method.java:580)
       at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)
       at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
       at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
       at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)
       at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
       at java.lang.reflect.Method.invoke (Method.java:580)
       at org.apache.maven.wrapper.BootstrapMainStarter.start (BootstrapMainStarter.java:52)
       at org.apache.maven.wrapper.WrapperExecutor.execute (WrapperExecutor.java:161)
       at org.apache.maven.wrapper.MavenWrapperMain.main (MavenWrapperMain.java:73)
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [MCOMPILER-538] Do not add target/generated-sources/annotations to the source roots [maven-compiler-plugin]

Posted by "slawekjaranowski (via GitHub)" <gi...@apache.org>.
slawekjaranowski merged PR #191:
URL: https://github.com/apache/maven-compiler-plugin/pull/191


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [MCOMPILER-538] Do not add target/generated-sources/annotations to the source roots [maven-compiler-plugin]

Posted by "slawekjaranowski (via GitHub)" <gi...@apache.org>.
slawekjaranowski commented on PR #191:
URL: https://github.com/apache/maven-compiler-plugin/pull/191#issuecomment-2711458373

   > The PR descripations says
   > 
   > > The generatedSourcesPath will still be added to the maven project paths.
   > 
   > But this is not the case, the [entire code](https://github.com/apache/maven-compiler-plugin/pull/191/files#diff-d4bac42d8f4c68d397ddbaa05c1cbbed7984ef6dc0bb9ea60739df78997e99eeL842) related to source paths was removed. This means that downstream plugins no longer see the generated sources. For example, the source-jar will no longer contain the generated sources. I'm pretty sure that's not what you wanted and will upset anyone who relies on https://issues.apache.org/jira/browse/MCOMPILER-157. Wasn't the idea to only remove [this line](https://github.com/apache/maven-compiler-plugin/pull/191/files#diff-d4bac42d8f4c68d397ddbaa05c1cbbed7984ef6dc0bb9ea60739df78997e99eeL828)? That should have been enough to fix [MCOMPILER-538](https://issues.apache.org/jira/browse/MCOMPILER-538) without any side effects.
   
   Looks like missing tests for MCOMPILER-157 ... 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [MCOMPILER-538] Do not add target/generated-sources/annotations to the source roots [maven-compiler-plugin]

Posted by "jorsol (via GitHub)" <gi...@apache.org>.
jorsol commented on PR #191:
URL: https://github.com/apache/maven-compiler-plugin/pull/191#issuecomment-1868145349

   @Nthalk version 3.12.1 is going to be released in a couple of days fixing that issue.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [MCOMPILER-538] Do not add target/generated-sources/annotations to the source roots [maven-compiler-plugin]

Posted by "oehme (via GitHub)" <gi...@apache.org>.
oehme commented on PR #191:
URL: https://github.com/apache/maven-compiler-plugin/pull/191#issuecomment-2713286426

   You can do it without these hacks by moving the generated sources code after the stale source scanning code. The important part is that it needs to happen before the mojo returns, but after it has scanned its own sources.
   
   ```diff
   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 5631892..27ea1f3 100644
   --- a/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
   +++ b/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
   @@ -814,16 +814,6 @@ public abstract class AbstractCompilerMojo extends AbstractMojo {
    
            compilerConfiguration.setProc(proc);
    
   -        File generatedSourcesDirectory = getGeneratedSourcesDirectory();
   -        compilerConfiguration.setGeneratedSourcesDirectory(
   -                generatedSourcesDirectory != null ? generatedSourcesDirectory.getAbsoluteFile() : null);
   -
   -        if (generatedSourcesDirectory != null) {
   -            if (!generatedSourcesDirectory.exists()) {
   -                generatedSourcesDirectory.mkdirs();
   -            }
   -        }
   -
            compilerConfiguration.setSourceLocations(compileSourceRoots);
    
            compilerConfiguration.setAnnotationProcessors(annotationProcessors);
   @@ -933,9 +923,6 @@ public abstract class AbstractCompilerMojo extends AbstractMojo {
                        getLog().info("Recompiling the module because of "
                                + MessageUtils.buffer().strong(cause) + ".");
                        compilerConfiguration.setSourceFiles(sources);
   -                } else {
   -                    getLog().info("Nothing to compile - all classes are up to date.");
   -                    return;
                    }
                } catch (CompilerException e) {
                    throw new MojoExecutionException("Error while computing stale sources.", e);
   @@ -964,11 +951,6 @@ public abstract class AbstractCompilerMojo extends AbstractMojo {
                    throw new MojoExecutionException("Error while computing stale sources.", e);
                }
    
   -            if (staleSources.isEmpty()) {
   -                getLog().info("Nothing to compile - all classes are up to date.");
   -                return;
   -            }
   -
                compilerConfiguration.setSourceFiles(staleSources);
    
                try {
   @@ -988,6 +970,41 @@ public abstract class AbstractCompilerMojo extends AbstractMojo {
                }
            }
    
   +        File generatedSourcesDirectory = getGeneratedSourcesDirectory();
   +        compilerConfiguration.setGeneratedSourcesDirectory(
   +                generatedSourcesDirectory != null ? generatedSourcesDirectory.getAbsoluteFile() : null);
   +
   +        if (generatedSourcesDirectory != null) {
   +            if (!generatedSourcesDirectory.exists()) {
   +                generatedSourcesDirectory.mkdirs();
   +            }
   +
   +            String generatedSourcesPath = generatedSourcesDirectory.getAbsolutePath();
   +
   +            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  "));
   +            }
   +        }
   +
   +        if (compilerConfiguration.getSourceFiles().isEmpty()) {
   +            getLog().info("Nothing to compile - all classes are up to date.");
   +            return;
   +        }
   +
   
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [MCOMPILER-538] Do not add target/generated-sources/annotations to the source roots [maven-compiler-plugin]

Posted by "mensinda (via GitHub)" <gi...@apache.org>.
mensinda commented on PR #191:
URL: https://github.com/apache/maven-compiler-plugin/pull/191#issuecomment-2713528123

   @oehme Thanks for the idea, I have added an alternative implementation / fix with #312.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [MCOMPILER-538] Do not add target/generated-sources/annotations to the source roots [maven-compiler-plugin]

Posted by "oehme (via GitHub)" <gi...@apache.org>.
oehme commented on PR #191:
URL: https://github.com/apache/maven-compiler-plugin/pull/191#issuecomment-2711465929

   Actually, I think there is a test - SourcePathReadGoal - but that was changed as part of this PR too.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [MCOMPILER-538] Do not add target/generated-sources/annotations to the source roots [maven-compiler-plugin]

Posted by "mensinda (via GitHub)" <gi...@apache.org>.
mensinda commented on PR #191:
URL: https://github.com/apache/maven-compiler-plugin/pull/191#issuecomment-2713069230

   Ah, it has been so long that I completely forgot about that part in the description.
   
   Sadly, removing the generated source path from the project *is* required. The new testcase fails if the relevant code sections are reverted:
   
   ```diff
   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 d3691fa..46b7d2b 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,17 +47,12 @@ public class SourcePathReadGoal extends AbstractMojo {
        public void execute() throws MojoExecutionException, MojoFailureException {
            if (sourceClass != null) {
                getLog().info("Checking compile source roots for: '" + sourceClass + "'");
   -            List<String> roots = project.getCompileSourceRoots();
   -            roots.add(project.getModel().getBuild().getOutputDirectory() + "/../generated-sources/annotations");
   -            assertGeneratedSourceFileFor(sourceClass, roots);
   +            assertGeneratedSourceFileFor(sourceClass, project.getCompileSourceRoots());
            }
   
            if (testSourceClass != null) {
                getLog().info("Checking test-compile source roots for: '" + testSourceClass + "'");
   -            List<String> roots = project.getTestCompileSourceRoots();
   -            roots.add(
   -                    project.getModel().getBuild().getOutputDirectory() + "/../generated-test-sources/test-annotations");
   -            assertGeneratedSourceFileFor(testSourceClass, roots);
   +            assertGeneratedSourceFileFor(testSourceClass, project.getTestCompileSourceRoots());
            }
        }
   
   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 5631892..8a94573 100644
   --- a/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
   +++ b/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
   @@ -824,6 +824,26 @@ public abstract class AbstractCompilerMojo extends AbstractMojo {
                }
            }
   
   +        String generatedSourcesPath = generatedSourcesDirectory.getAbsolutePath();
   +
   +        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);
   
            compilerConfiguration.setAnnotationProcessors(annotationProcessors);
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [MCOMPILER-538] Do not add target/generated-sources/annotations to the source roots [maven-compiler-plugin]

Posted by "elharo (via GitHub)" <gi...@apache.org>.
elharo commented on PR #191:
URL: https://github.com/apache/maven-compiler-plugin/pull/191#issuecomment-2669687188

   Is the build working or is the CI borked again:
   
   Error:  Failed to execute goal com.kohlschutter.mavenplugins:copy-rename-maven-plugin:2.0.0:copy (set-source) on project code: The plugin com.kohlschutter.mavenplugins:copy-rename-maven-plugin:2.0.0 requires Maven version 3.8.8 -> [Help 1]
   org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.kohlschutter.mavenplugins:copy-rename-maven-plugin:2.0.0:copy (set-source) on project code: The plugin com.kohlschutter.mavenplugins:copy-rename-maven-plugin:2.0.0 requires Maven version 3.8.8
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [MCOMPILER-538] Do not add target/generated-sources/annotations to the source roots [maven-compiler-plugin]

Posted by "slawekjaranowski (via GitHub)" <gi...@apache.org>.
slawekjaranowski commented on PR #191:
URL: https://github.com/apache/maven-compiler-plugin/pull/191#issuecomment-1868099987

   > All my projects that test upgrades to 3.12.0 fail because of this line, looking forward to when it's removed!
   
   @Nthalk We need more details. There is a version 3.12.1 under vote, will be available in a few day.
   Please comments in JIRA


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [MCOMPILER-538] Do not add target/generated-sources/annotations to the source roots [maven-compiler-plugin]

Posted by "mensinda (via GitHub)" <gi...@apache.org>.
mensinda commented on PR #191:
URL: https://github.com/apache/maven-compiler-plugin/pull/191#issuecomment-2454698513

   I have rebased the PR and added a test case.
   
   I am not really happy with the hardcoded paths in `SourcePathReadGoal.java` myself, but I couldn't figure out a better solution.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [MCOMPILER-538] Do not add target/generated-sources/annotations to the source roots [maven-compiler-plugin]

Posted by "mensinda (via GitHub)" <gi...@apache.org>.
mensinda commented on PR #191:
URL: https://github.com/apache/maven-compiler-plugin/pull/191#issuecomment-2668054346

   Not sure why the CI failed before and the logs are gone now. I have rebased the PR and `mvn -Prun-its verify` ran successfully on my machine.
   
   @elharo @slawekjaranowski There also is a test case now, as requested.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [MCOMPILER-538] Do not add target/generated-sources/annotations to the source roots [maven-compiler-plugin]

Posted by "mensinda (via GitHub)" <gi...@apache.org>.
mensinda commented on PR #191:
URL: https://github.com/apache/maven-compiler-plugin/pull/191#issuecomment-2668694785

   Nevermind, I was using Java 17 multiline string literals in the test-case. The CI should run now.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [MCOMPILER-538] Do not add target/generated-sources/annotations to the source roots [maven-compiler-plugin]

Posted by "oehme (via GitHub)" <gi...@apache.org>.
oehme commented on PR #191:
URL: https://github.com/apache/maven-compiler-plugin/pull/191#issuecomment-2711341570

   The PR descripations says
   
   > The generatedSourcesPath will still be added to the maven project paths.
   
   But this is not the case, the [entire code](https://github.com/apache/maven-compiler-plugin/pull/191/files#diff-d4bac42d8f4c68d397ddbaa05c1cbbed7984ef6dc0bb9ea60739df78997e99eeL842
   ) related to source paths was removed. This means that downstream plugins no longer see the generated sources. For example, the source-jar will no longer contain the generated sources. I'm pretty sure that's not what you wanted. Wasn't the idea to only remove [this line](https://github.com/apache/maven-compiler-plugin/pull/191/files#diff-d4bac42d8f4c68d397ddbaa05c1cbbed7984ef6dc0bb9ea60739df78997e99eeL828)?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [MCOMPILER-538] Do not add target/generated-sources/annotations to the source roots [maven-compiler-plugin]

Posted by "desruisseaux (via GitHub)" <gi...@apache.org>.
desruisseaux commented on PR #191:
URL: https://github.com/apache/maven-compiler-plugin/pull/191#issuecomment-2674079945

   > Should we try to add the same test to master branch?
   
   Probably. It is desirable that the master contains most of the tests of the 3.x branch.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [MCOMPILER-538] Do not add target/generated-sources/annotations to the source roots [maven-compiler-plugin]

Posted by "Nthalk (via GitHub)" <gi...@apache.org>.
Nthalk commented on PR #191:
URL: https://github.com/apache/maven-compiler-plugin/pull/191#issuecomment-1868075328

   All my projects that test upgrades to 3.12.0 fail because of this line, looking forward to when it's removed!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org