[ 
https://issues.apache.org/jira/browse/MCOMPILER-235?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15114259#comment-15114259
 ] 

Thomas Broyer commented on MCOMPILER-235:
-----------------------------------------

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)

> duplicate classes due to MCOMPILER-157 when compiler is called twice or more
> ----------------------------------------------------------------------------
>
>                 Key: MCOMPILER-235
>                 URL: https://issues.apache.org/jira/browse/MCOMPILER-235
>             Project: Maven Compiler Plugin
>          Issue Type: Bug
>    Affects Versions: 3.2
>         Environment: Maven 3.2.3
>            Reporter: Arnaud HERITIER
>            Assignee: Andreas Gudian
>         Attachments: MCOMPILER-235.zip
>
>
> 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 :
> {code}
> [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 
> {code}
> 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)
> {code}
> git clone https://github.com/exoplatform/commons.git && cd commons && git 
> checkout 4.1.0-RC1 && mvn site -Dversion.compiler.plugin=3.2
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to