Uploaded image for project: 'Maven Compiler Plugin'
  1. Maven Compiler Plugin
  2. MCOMPILER-235

duplicate classes due to MCOMPILER-157 when compiler is called twice or more

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.2
    • Fix Version/s: 3.5.1
    • Labels:
      None
    • Environment:
      Maven 3.2.3

      Description

      I tried to upgrade our projects to use the compiler 3.2 and instead of 3.1
      Classical builds are ok but site builds are KO because for various reasons (reports) the lifecycle is forked and thus the compiler is called twice (or more) and fails because it finds duplicated classes
      Example :

      [INFO] ------------------------------------------------------------------------
      [INFO] Building eXo Commons - Common Services 4.1.x-SNAPSHOT
      [INFO] ------------------------------------------------------------------------
      [INFO] 
      [INFO] --- maven-enforcer-plugin:1.3.1:enforce (enforce-java-version) @ commons-component-common ---
      [INFO] 
      [INFO] --- maven-enforcer-plugin:1.3.1:enforce (enforce-maven-version) @ commons-component-common ---
      [INFO] 
      [INFO] --- buildnumber-maven-plugin:1.3:create (default) @ commons-component-common ---
      [INFO] 
      [INFO] --- jacoco-maven-plugin:0.7.2.201409121644:prepare-agent (prepare-ut-agent) @ commons-component-common ---
      [INFO] argLine set to -javaagent:/srv/ciagent/workspace/commons-master-site/.repository/org/jacoco/org.jacoco.agent/0.7.2.201409121644/org.jacoco.agent-0.7.2.201409121644-runtime.jar=destfile=/srv/ciagent/workspace/commons-master-site/sources/commons-component-common/target/jacoco.exec,append=true
      [INFO] 
      [INFO] --- maven-resources-plugin:2.7:resources (default-resources) @ commons-component-common ---
      [INFO] Using 'UTF-8' encoding to copy filtered resources.
      [INFO] Copying 0 resource
      [INFO] Copying 5 resources
      [INFO] 
      [INFO] --- maven-compiler-plugin:3.2:compile (default-compile) @ commons-component-common ---
      [INFO] Changes detected - recompiling the module!
      [INFO] Compiling 97 source files to /srv/ciagent/workspace/commons-master-site/sources/commons-component-common/target/classes
      [WARNING] Supported source version 'RELEASE_5' from annotation processor 'org.chromattic.apt.ChromatticProcessor' less than -source '1.7'
      [INFO] About to process the type org.exoplatform.settings.chromattic.SettingsRoot
      [INFO] About to process the type org.exoplatform.settings.chromattic.SubContextEntity
      [INFO] About to process the type org.exoplatform.settings.chromattic.SimpleContextEntity
      [INFO] About to process the type org.exoplatform.settings.chromattic.ScopeEntity
      [INFO] About to process the type org.exoplatform.settings.chromattic.ContextEntity
      [INFO] Processing node type package org.exoplatform.settings.chromattic
      [INFO] /srv/ciagent/workspace/commons-master-site/sources/commons-component-common/src/main/java/org/exoplatform/services/user/UserStateService.java: Some input files use unchecked or unsafe operations.
      [INFO] /srv/ciagent/workspace/commons-master-site/sources/commons-component-common/src/main/java/org/exoplatform/services/user/UserStateService.java: Recompile with -Xlint:unchecked for details.
      [INFO] 
      [INFO] --- maven-resources-plugin:2.7:testResources (default-testResources) @ commons-component-common ---
      [INFO] Using 'UTF-8' encoding to copy filtered resources.
      [INFO] Copying 19 resources
      [INFO] 
      [INFO] --- maven-compiler-plugin:3.2:testCompile (default-testCompile) @ commons-component-common ---
      [INFO] Changes detected - recompiling the module!
      [INFO] Compiling 32 source files to /srv/ciagent/workspace/commons-master-site/sources/commons-component-common/target/test-classes
      [WARNING] /srv/ciagent/workspace/commons-master-site/sources/commons-component-common/src/test/java/org/exoplatform/commons/event/TestEventManager.java:[29,23] junit.framework.Assert in junit.framework has been deprecated
      [WARNING] Supported source version 'RELEASE_5' from annotation processor 'org.chromattic.apt.ChromatticProcessor' less than -source '1.7'
      [WARNING] Supported source version 'RELEASE_5' from annotation processor 'org.chromattic.testgenerator.CheckTestProcessor' less than -source '1.7'
      [WARNING] /srv/ciagent/workspace/commons-master-site/sources/commons-component-common/src/test/java/org/exoplatform/commons/event/TestEventManager.java:[29,23] junit.framework.Assert in junit.framework has been deprecated
      [WARNING] /srv/ciagent/workspace/commons-master-site/sources/commons-component-common/src/test/java/org/exoplatform/commons/event/TestEventManager.java:[29,23] junit.framework.Assert in junit.framework has been deprecated
      [WARNING] /srv/ciagent/workspace/commons-master-site/sources/commons-component-common/src/test/java/org/exoplatform/commons/event/TestEventManager.java:[88,9] junit.framework.Assert in junit.framework has been deprecated
      [WARNING] /srv/ciagent/workspace/commons-master-site/sources/commons-component-common/src/test/java/org/exoplatform/commons/event/TestEventManager.java:[95,9] junit.framework.Assert in junit.framework has been deprecated
      [WARNING] /srv/ciagent/workspace/commons-master-site/sources/commons-component-common/src/test/java/org/exoplatform/commons/event/TestEventManager.java:[123,9] junit.framework.Assert in junit.framework has been deprecated
      [WARNING] /srv/ciagent/workspace/commons-master-site/sources/commons-component-common/src/test/java/org/exoplatform/commons/event/TestEventManager.java:[130,9] junit.framework.Assert in junit.framework has been deprecated
      [WARNING] /srv/ciagent/workspace/commons-master-site/sources/commons-component-common/src/test/java/org/exoplatform/commons/event/TestEventManager.java:[135,9] junit.framework.Assert in junit.framework has been deprecated
      [WARNING] /srv/ciagent/workspace/commons-master-site/sources/commons-component-common/src/test/java/org/exoplatform/settings/impl/UserSettingServiceTest.java:[136,17] setCreatedDate(java.util.Date) in org.exoplatform.services.organization.User has been deprecated
      [INFO] /srv/ciagent/workspace/commons-master-site/sources/commons-component-common/src/test/java/org/exoplatform/settings/impl/SettingServiceEventTest.java: /srv/ciagent/workspace/commons-master-site/sources/commons-component-common/src/test/java/org/exoplatform/settings/impl/SettingServiceEventTest.java uses unchecked or unsafe operations.
      [INFO] /srv/ciagent/workspace/commons-master-site/sources/commons-component-common/src/test/java/org/exoplatform/settings/impl/SettingServiceEventTest.java: Recompile with -Xlint:unchecked for details.
      [INFO] 
      [INFO] --- maven-surefire-plugin:2.17:test (default-test) @ commons-component-common ---
      [INFO] Surefire report directory: /srv/ciagent/workspace/commons-master-site/sources/commons-component-common/target/surefire-reports
      
      -------------------------------------------------------
       T E S T S
      -------------------------------------------------------
      Running org.exoplatform.services.user.RESTUserServiceTest
      Tests run: 1, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0.112 sec - in org.exoplatform.services.user.RESTUserServiceTest
      Running org.exoplatform.services.user.UserStateServiceTest
      Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 14.127 sec - in org.exoplatform.services.user.UserStateServiceTest
      Running org.exoplatform.services.bench.TestDataInjector
      Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.653 sec - in org.exoplatform.services.bench.TestDataInjector
      Running org.exoplatform.services.bench.TestDataInjectorService
      Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.327 sec - in org.exoplatform.services.bench.TestDataInjectorService
      Running org.exoplatform.services.deployment.TestContentInitializerService
      Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.006 sec - in org.exoplatform.services.deployment.TestContentInitializerService
      Running org.exoplatform.services.deployment.ContentInitializerServiceTest
      Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.151 sec - in org.exoplatform.services.deployment.ContentInitializerServiceTest
      Running org.exoplatform.services.deployment.plugins.XMLDeploymentPluginTest
      Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.718 sec - in org.exoplatform.services.deployment.plugins.XMLDeploymentPluginTest
      Running org.exoplatform.services.deployment.UtilsTest
      Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.45 sec - in org.exoplatform.services.deployment.UtilsTest
      Running org.exoplatform.commons.utils.CommonsUtilsTest
      Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.331 sec - in org.exoplatform.commons.utils.CommonsUtilsTest
      Running org.exoplatform.commons.utils.TestActivityTypeUtils
      Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.412 sec - in org.exoplatform.commons.utils.TestActivityTypeUtils
      Running org.exoplatform.commons.utils.XPathUtilsTest
      Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.4 sec - in org.exoplatform.commons.utils.XPathUtilsTest
      Running org.exoplatform.commons.embedder.EmbedderTest
      Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.205 sec - in org.exoplatform.commons.embedder.EmbedderTest
      Running org.exoplatform.commons.notification.template.TemplateUtilsTestCase
      Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.266 sec - in org.exoplatform.commons.notification.template.TemplateUtilsTestCase
      Running org.exoplatform.commons.notification.NotificationContextImplTest
      Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.266 sec - in org.exoplatform.commons.notification.NotificationContextImplTest
      Running org.exoplatform.commons.notification.NotificationServiceTest
      Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.249 sec - in org.exoplatform.commons.notification.NotificationServiceTest
      Running org.exoplatform.commons.notification.TemplateTestCase
      Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.605 sec - in org.exoplatform.commons.notification.TemplateTestCase
      Running org.exoplatform.commons.notification.TestNotificationUtils
      Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.315 sec - in org.exoplatform.commons.notification.TestNotificationUtils
      Running org.exoplatform.commons.notification.PluginContainerTest
      Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.356 sec - in org.exoplatform.commons.notification.PluginContainerTest
      Running org.exoplatform.commons.event.TestEventManager
      Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.507 sec - in org.exoplatform.commons.event.TestEventManager
      Running org.exoplatform.settings.impl.SettingServiceEventTest
      Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.605 sec - in org.exoplatform.settings.impl.SettingServiceEventTest
      Running org.exoplatform.settings.impl.UserSettingServiceTest
      Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.861 sec - in org.exoplatform.settings.impl.UserSettingServiceTest
      Running org.exoplatform.settings.impl.CacheSettingTest
      Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.58 sec - in org.exoplatform.settings.impl.CacheSettingTest
      Running org.exoplatform.settings.impl.FeatureServiceTest
      Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.12 sec - in org.exoplatform.settings.impl.FeatureServiceTest
      Running org.exoplatform.settings.impl.SettingServiceImplTest
      Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.995 sec - in org.exoplatform.settings.impl.SettingServiceImplTest
      Running org.exoplatform.job.MultiTenancyTaskTest
      Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.148 sec - in org.exoplatform.job.MultiTenancyTaskTest
      Running org.exoplatform.job.MultiTenancyJobTest
      Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.118 sec - in org.exoplatform.job.MultiTenancyJobTest
      
      Results :
      
      Tests run: 77, Failures: 0, Errors: 0, Skipped: 1
      
      [JENKINS] Recording test results
      [INFO] 
      [INFO] --- build-helper-maven-plugin:1.9.1:parse-version (parse-version) @ commons-component-common ---
      [INFO] 
      [INFO] --- maven-jar-plugin:2.5:jar (default-jar) @ commons-component-common ---
      [INFO] Building jar: /srv/ciagent/workspace/commons-master-site/sources/commons-component-common/target/commons-component-common-4.1.x-SNAPSHOT.jar
      [INFO] 
      [INFO] --- maven-source-plugin:2.4:jar-no-fork (attach-sources) @ commons-component-common ---
      [INFO] Building jar: /srv/ciagent/workspace/commons-master-site/sources/commons-component-common/target/commons-component-common-4.1.x-SNAPSHOT-sources.jar
      [INFO] 
      [INFO] --- jacoco-maven-plugin:0.7.2.201409121644:prepare-agent-integration (prepare-it-agent) @ commons-component-common ---
      [INFO] argLine set to -javaagent:/srv/ciagent/workspace/commons-master-site/.repository/org/jacoco/org.jacoco.agent/0.7.2.201409121644/org.jacoco.agent-0.7.2.201409121644-runtime.jar=destfile=/srv/ciagent/workspace/commons-master-site/sources/commons-component-common/target/jacoco-it.exec,append=true
      [INFO] 
      [INFO] --- maven-failsafe-plugin:2.17:integration-test (integration-test) @ commons-component-common ---
      [JENKINS] Recording test results
      [INFO] 
      [INFO] --- maven-failsafe-plugin:2.17:verify (verify) @ commons-component-common ---
      [INFO] Failsafe report directory: /srv/ciagent/workspace/commons-master-site/sources/commons-component-common/target/surefire-reports
      [JENKINS] Recording test results
      [INFO] 
      [INFO] --- maven-site-plugin:3.4:site (default-site) @ commons-component-common ---
      [INFO] configuring report plugin org.apache.maven.plugins:maven-project-info-reports-plugin:2.7
      [INFO] configuring report plugin org.apache.maven.plugins:maven-dependency-plugin:2.9
      [INFO] preparing 'analyze-report' report requires 'test-compile' forked phase execution
      [INFO] 
      [INFO] >>> maven-dependency-plugin:2.9:analyze-report @ commons-component-common >>>
      [INFO] 
      [INFO] --- maven-enforcer-plugin:1.3.1:enforce (enforce-java-version) @ commons-component-common ---
      [INFO] 
      [INFO] --- maven-enforcer-plugin:1.3.1:enforce (enforce-maven-version) @ commons-component-common ---
      [INFO] 
      [INFO] --- buildnumber-maven-plugin:1.3:create (default) @ commons-component-common ---
      [INFO] 
      [INFO] --- jacoco-maven-plugin:0.7.2.201409121644:prepare-agent (prepare-ut-agent) @ commons-component-common ---
      [INFO] argLine set to -javaagent:/srv/ciagent/workspace/commons-master-site/.repository/org/jacoco/org.jacoco.agent/0.7.2.201409121644/org.jacoco.agent-0.7.2.201409121644-runtime.jar=destfile=/srv/ciagent/workspace/commons-master-site/sources/commons-component-common/target/jacoco.exec,append=true
      [INFO] 
      [INFO] --- maven-resources-plugin:2.7:resources (default-resources) @ commons-component-common ---
      [INFO] Using 'UTF-8' encoding to copy filtered resources.
      [INFO] Copying 0 resource
      [INFO] Copying 5 resources
      [INFO] 
      [INFO] --- maven-compiler-plugin:3.2:compile (default-compile) @ commons-component-common ---
      [INFO] Changes detected - recompiling the module!
      [INFO] Compiling 107 source files to /srv/ciagent/workspace/commons-master-site/sources/commons-component-common/target/classes
      [INFO] About to process the type org.exoplatform.settings.chromattic.SimpleContextEntity
      [INFO] About to process the type org.exoplatform.settings.chromattic.SettingsRoot
      [INFO] About to process the type org.exoplatform.settings.chromattic.SubContextEntity
      [INFO] About to process the type org.exoplatform.settings.chromattic.ScopeEntity
      [INFO] About to process the type org.exoplatform.settings.chromattic.ContextEntity
      [INFO] Processing node type package org.exoplatform.settings.chromattic
      [INFO] -------------------------------------------------------------
      [WARNING] COMPILATION WARNING : 
      [INFO] -------------------------------------------------------------
      [WARNING] Supported source version 'RELEASE_5' from annotation processor 'org.chromattic.apt.ChromatticProcessor' less than -source '1.7'
      [INFO] 1 warning
      [INFO] -------------------------------------------------------------
      [INFO] -------------------------------------------------------------
      [ERROR] COMPILATION ERROR : 
      [INFO] -------------------------------------------------------------
      [ERROR] /srv/ciagent/workspace/commons-master-site/sources/commons-component-common/target/generated-sources/annotations/org/exoplatform/settings/chromattic/SimpleContextEntity_Chromattic.java:[4,8] duplicate class: org.exoplatform.settings.chromattic.SimpleContextEntity_Chromattic
      [ERROR] /srv/ciagent/workspace/commons-master-site/sources/commons-component-common/target/generated-sources/annotations/org/exoplatform/settings/chromattic/SettingsRoot_Chromattic.java:[4,8] duplicate class: org.exoplatform.settings.chromattic.SettingsRoot_Chromattic
      [ERROR] /srv/ciagent/workspace/commons-master-site/sources/commons-component-common/target/generated-sources/annotations/org/exoplatform/settings/chromattic/SubContextEntity_Chromattic.java:[4,8] duplicate class: org.exoplatform.settings.chromattic.SubContextEntity_Chromattic
      [ERROR] /srv/ciagent/workspace/commons-master-site/sources/commons-component-common/target/generated-sources/annotations/org/exoplatform/settings/chromattic/ScopeEntity_Chromattic.java:[4,8] duplicate class: org.exoplatform.settings.chromattic.ScopeEntity_Chromattic
      [ERROR] /srv/ciagent/workspace/commons-master-site/sources/commons-component-common/target/generated-sources/annotations/org/exoplatform/settings/chromattic/ContextEntity_Chromattic.java:[4,8] duplicate class: org.exoplatform.settings.chromattic.ContextEntity_Chromattic
      [ERROR] /srv/ciagent/workspace/commons-master-site/sources/commons-component-common/target/generated-sources/annotations/org/exoplatform/settings/chromattic/ScopeEntity_.java:[3,8] duplicate class: org.exoplatform.settings.chromattic.ScopeEntity_
      [ERROR] /srv/ciagent/workspace/commons-master-site/sources/commons-component-common/target/generated-sources/annotations/org/exoplatform/settings/chromattic/SimpleContextEntity_.java:[3,8] duplicate class: org.exoplatform.settings.chromattic.SimpleContextEntity_
      [ERROR] /srv/ciagent/workspace/commons-master-site/sources/commons-component-common/target/generated-sources/annotations/org/exoplatform/settings/chromattic/ContextEntity_.java:[3,8] duplicate class: org.exoplatform.settings.chromattic.ContextEntity_
      [ERROR] /srv/ciagent/workspace/commons-master-site/sources/commons-component-common/target/generated-sources/annotations/org/exoplatform/settings/chromattic/SubContextEntity_.java:[3,8] duplicate class: org.exoplatform.settings.chromattic.SubContextEntity_
      [ERROR] /srv/ciagent/workspace/commons-master-site/sources/commons-component-common/target/generated-sources/annotations/org/exoplatform/settings/chromattic/SettingsRoot_.java:[3,8] duplicate class: org.exoplatform.settings.chromattic.SettingsRoot_
      [INFO] 10 errors 
      

      Full logs : https://ci.exoplatform.org/job/commons-master-site/26/console

      It seems to be related to MCOMPILER-157 but I don't really know if it should be considered as a bug in the compiler plugin
      You can reproduce it with (I hope)

      git clone https://github.com/exoplatform/commons.git && cd commons && git checkout 4.1.0-RC1 && mvn site -Dversion.compiler.plugin=3.2
      

        Issue Links

          Activity

          Hide
          agudian Andreas Gudian added a comment -

          Oops, indeed. Thanks!

          Show
          agudian Andreas Gudian added a comment - Oops, indeed. Thanks!
          Hide
          mlassiter Mark Lassiter added a comment -

          Stumbled on this and noted that the Fixed Version incorrectly states 2.5.1. I believe it is meant to say 3.5.1.

          Show
          mlassiter Mark Lassiter added a comment - Stumbled on this and noted that the Fixed Version incorrectly states 2.5.1. I believe it is meant to say 3.5.1.
          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in maven-plugins #5035 (See https://builds.apache.org/job/maven-plugins/5035/)
          MCOMPILER-235 extend IT to verify that the repeated build without a clean works when using an annotation processor that generates java sources. (agudian: http://svn.apache.org/viewvc/?view=rev&rev=1727173)

          • maven-compiler-plugin/src/it/MCOMPILER-203-processorpath/annotation-processor/src/main/java/org/issue/SimpleAnnotationProcessor.java
          • maven-compiler-plugin/src/it/MCOMPILER-203-processorpath/invoker.properties
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in maven-plugins #5035 (See https://builds.apache.org/job/maven-plugins/5035/ ) MCOMPILER-235 extend IT to verify that the repeated build without a clean works when using an annotation processor that generates java sources. (agudian: http://svn.apache.org/viewvc/?view=rev&rev=1727173 ) maven-compiler-plugin/src/it/ MCOMPILER-203 -processorpath/annotation-processor/src/main/java/org/issue/SimpleAnnotationProcessor.java maven-compiler-plugin/src/it/ MCOMPILER-203 -processorpath/invoker.properties
          Hide
          agudian Andreas Gudian added a comment -

          Thanks for trying it out!

          I've extended a test now as well - just wanted to make sure I'm in the right ballpark regarding the supposed error (the error message is looking quite different on Java 8).

          Show
          agudian Andreas Gudian added a comment - Thanks for trying it out! I've extended a test now as well - just wanted to make sure I'm in the right ballpark regarding the supposed error (the error message is looking quite different on Java 8).
          Hide
          t.broyer Thomas Broyer added a comment -

          The source code changes look good, but wouldn't it be somewhat easier to just defer adding the generatedSourcesDirectory to the compileSourceRoots to after the actual compilation (or use of the compileSourceRoots) ? (accounting for the early exits when everything's up-to-date and compilation is skipped entirely)

          Also tried it and it appears to work OK (would be even better to ensure non-regression in the future with an integration test if you ask me, just have the `invoker.properties` do the build twice)

          Show
          t.broyer Thomas Broyer added a comment - The source code changes look good, but wouldn't it be somewhat easier to just defer adding the generatedSourcesDirectory to the compileSourceRoots to after the actual compilation (or use of the compileSourceRoots) ? (accounting for the early exits when everything's up-to-date and compilation is skipped entirely) Also tried it and it appears to work OK (would be even better to ensure non-regression in the future with an integration test if you ask me, just have the `invoker.properties` do the build twice)
          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in maven-plugins #5007 (See https://builds.apache.org/job/maven-plugins/5007/)
          MCOMPILER-235 do not add files from generatedSourcesDirectory to the list of source files to compile. (agudian: http://svn.apache.org/viewvc/?view=rev&rev=1726074)

          • maven-compiler-plugin/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in maven-plugins #5007 (See https://builds.apache.org/job/maven-plugins/5007/ ) MCOMPILER-235 do not add files from generatedSourcesDirectory to the list of source files to compile. (agudian: http://svn.apache.org/viewvc/?view=rev&rev=1726074 ) maven-compiler-plugin/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
          Hide
          agudian Andreas Gudian added a comment -

          I've just committed a possible fix for this and it works for me now.

          As there are quite some different sightings of this issue and also different types of errors observed based on this, I'd appreciate some feedback from here. The safest way for testing would be checking out the code (https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-compiler-plugin - or use the github-mirror), mvn clean install it and use the 3.6-SNAPSHOT version in your build.

          Thanks!

          Show
          agudian Andreas Gudian added a comment - I've just committed a possible fix for this and it works for me now. As there are quite some different sightings of this issue and also different types of errors observed based on this, I'd appreciate some feedback from here. The safest way for testing would be checking out the code ( https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-compiler-plugin - or use the github-mirror), mvn clean install it and use the 3.6-SNAPSHOT version in your build. Thanks!
          Hide
          jmhodges Jeff Hodges added a comment - - edited

          I put this on MCOMPILER-236, but since it was mentioned here, I'll duplicate the response.

          Just to inform folks: setting useIncrementalCompilation will turn on maven's incremental compilation, not turn it off. And the incremental compile code has a history of not being smart enough to do what you want (plus hurts folks who want to use forked builds).

          The documentation is not clear about this boolean and you have to go digging through the code for that information. See this code and the stale sources calculation that seems to be what's in maven 3.3.

          Show
          jmhodges Jeff Hodges added a comment - - edited I put this on MCOMPILER-236 , but since it was mentioned here, I'll duplicate the response. Just to inform folks: setting useIncrementalCompilation will turn on maven's incremental compilation, not turn it off. And the incremental compile code has a history of not being smart enough to do what you want (plus hurts folks who want to use forked builds). The documentation is not clear about this boolean and you have to go digging through the code for that information. See this code and the stale sources calculation that seems to be what's in maven 3.3.
          Hide
          jmhodges Jeff Hodges added a comment -

          This is also happening for closure-templates because it uses autovalue. It's pretty frustrating.

          Show
          jmhodges Jeff Hodges added a comment - This is also happening for closure-templates because it uses autovalue. It's pretty frustrating.
          Hide
          gjoseph Grégory Joseph added a comment - - edited

          Using useIncrementalCompilation set explicitly to false as noted in MCOMPILER-236 seems to be a workaround for this also.
          MCOMPILER-157 makes a lot of sense, but causes headaches when used in a forked build, e.g with Clover. (and useIncrementalCompilation does NOT help, there)

          Show
          gjoseph Grégory Joseph added a comment - - edited Using useIncrementalCompilation set explicitly to false as noted in MCOMPILER-236 seems to be a workaround for this also. MCOMPILER-157 makes a lot of sense, but causes headaches when used in a forked build, e.g with Clover. (and useIncrementalCompilation does NOT help, there)
          Hide
          gsmet Guillaume Smet added a comment -

          Hi,

          We also had to go back to 3.1 because of issues with our annotation processors: we use Bindgen and, after the upgrade to 3.2, it started doing very weird things (it mixes classes, put Runnable in place of *BindingPath and other weird behaviors).

          I also suspect MCOMPILER-157 to be the root cause of this and I think this change has a lot more consequences than initially suspected.

          Show
          gsmet Guillaume Smet added a comment - Hi, We also had to go back to 3.1 because of issues with our annotation processors: we use Bindgen and, after the upgrade to 3.2, it started doing very weird things (it mixes classes, put Runnable in place of *BindingPath and other weird behaviors). I also suspect MCOMPILER-157 to be the root cause of this and I think this change has a lot more consequences than initially suspected.
          Hide
          drekbour Marc Carter added a comment -

          The problem is more fundamental than compile running twice in the same build. If you take any code-generating APT plugin and simply run mvn compile from the commandline it will fail second time around (i.e. you must clean compile to work around this)

          I checked this with two different APT plugins. Attached is a bare-bones project using Pojobuilder.

          $ mvn clean compile
          [INFO] Scanning for projects...
          [INFO]
          [INFO] ------------------------------------------------------------------------
          [INFO] Building apt-test 1.0-SNAPSHOT
          [INFO] ------------------------------------------------------------------------
          [INFO]
          [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ apt-test ---
          [INFO] Deleting C:\devsrc\external\apt-test\target
          [INFO]
          [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ apt-test ---
          [INFO] Using 'UTF-8' encoding to copy filtered resources.
          [INFO] skip non existing resourceDirectory C:\devsrc\external\apt-test\src\main\resources
          [INFO]
          [INFO] --- maven-compiler-plugin:3.2:compile (default-compile) @ apt-test ---
          [INFO] Changes detected - recompiling the module!
          [INFO] Compiling 1 source file to C:\devsrc\external\apt-test\target\classes
          [INFO] ------------------------------------------------------------------------
          [INFO] BUILD SUCCESS
          [INFO] ------------------------------------------------------------------------
          [INFO] Total time: 1.703 s
          [INFO] Finished at: 2014-11-05T13:45:31+00:00
          [INFO] Final Memory: 11M/246M
          [INFO] ------------------------------------------------------------------------
          
          $ mvn compile
          [INFO] Scanning for projects...
          [INFO]
          [INFO] ------------------------------------------------------------------------
          [INFO] Building apt-test 1.0-SNAPSHOT
          [INFO] ------------------------------------------------------------------------
          [INFO]
          [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ apt-test ---
          [INFO] Using 'UTF-8' encoding to copy filtered resources.
          [INFO] skip non existing resourceDirectory C:\devsrc\external\apt-test\src\main\resources
          [INFO]
          [INFO] --- maven-compiler-plugin:3.2:compile (default-compile) @ apt-test ---
          [INFO] Changes detected - recompiling the module!
          [INFO] Compiling 2 source files to C:\devsrc\external\apt-test\target\classes
          [INFO] -------------------------------------------------------------
          [ERROR] COMPILATION ERROR :
          [INFO] -------------------------------------------------------------
          [ERROR] /C:/devsrc/external/apt-test/target/generated-sources/annotations/maven/apt/PersonBuilder.java:[6,8] duplicate class: maven.apt.PersonBuilder
          [INFO] 1 error
          [INFO] -------------------------------------------------------------
          [INFO] ------------------------------------------------------------------------
          [INFO] BUILD FAILURE
          [INFO] ------------------------------------------------------------------------
          [INFO] Total time: 1.468 s
          [INFO] Finished at: 2014-11-05T13:45:42+00:00
          [INFO] Final Memory: 10M/246M
          
          Show
          drekbour Marc Carter added a comment - The problem is more fundamental than compile running twice in the same build. If you take any code-generating APT plugin and simply run mvn compile from the commandline it will fail second time around (i.e. you must clean compile to work around this) I checked this with two different APT plugins. Attached is a bare-bones project using Pojobuilder . $ mvn clean compile [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building apt-test 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ apt-test --- [INFO] Deleting C:\devsrc\external\apt-test\target [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ apt-test --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\devsrc\external\apt-test\src\main\resources [INFO] [INFO] --- maven-compiler-plugin:3.2:compile (default-compile) @ apt-test --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 1 source file to C:\devsrc\external\apt-test\target\classes [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.703 s [INFO] Finished at: 2014-11-05T13:45:31+00:00 [INFO] Final Memory: 11M/246M [INFO] ------------------------------------------------------------------------ $ mvn compile [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building apt-test 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ apt-test --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\devsrc\external\apt-test\src\main\resources [INFO] [INFO] --- maven-compiler-plugin:3.2:compile (default-compile) @ apt-test --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 2 source files to C:\devsrc\external\apt-test\target\classes [INFO] ------------------------------------------------------------- [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] /C:/devsrc/external/apt-test/target/generated-sources/annotations/maven/apt/PersonBuilder.java:[6,8] duplicate class: maven.apt.PersonBuilder [INFO] 1 error [INFO] ------------------------------------------------------------- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.468 s [INFO] Finished at: 2014-11-05T13:45:42+00:00 [INFO] Final Memory: 10M/246M

            People

            • Assignee:
              agudian Andreas Gudian
              Reporter:
              aheritier Arnaud HERITIER
            • Votes:
              13 Vote for this issue
              Watchers:
              17 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development