Community
Participate
Working Groups
See http://dev.eclipse.org/mhonarc/lists/tycho-user/msg01707.html The same source folder (once as compile source root and once as test compile source root) in the maven model causes a DuplicatedSourceException with sonar. Idea: only inject source folder into compile source roots of maven model if it's not already present in test compile source roots. Note that duplicates can only occur between compile source roots and test compile source roots. Each of the two source folder lists is actually a set so duplicates are avoided within the set.
(In reply to comment #0) > Idea: only inject source folder into compile source roots of maven model if > it's not already present in test compile source roots. This is unstable: assuming that it is really necessary (e.g. for interoperability), that the compile root of eclipse-test-plugin is set as Maven compile source root, Tycho should not behave differently if the Tycho source root happens to be src/test/java. Instead, the duplicate entry should be removed the Maven test source roots.
(In reply to comment #1) > (In reply to comment #0) > > Idea: only inject source folder into compile source roots of maven model if > > it's not already present in test compile source roots. > This is unstable: assuming that it is really necessary (e.g. for > interoperability), that the compile root of eclipse-test-plugin is set as Maven > compile source root, Tycho should not behave differently if the Tycho source > root happens to be src/test/java. > > Instead, the duplicate entry should be removed the Maven test source roots. just need to make sure an empty test compile roots list will not cause trouble somewhere else (in maven it's never be empty)
Created attachment 209449 [details] sample project reproducing the bug Steps to reproduce: 1. download sonar from http://www.sonarsource.org/downloads/ 2. unzip and start it http://docs.codehaus.org/display/SONAR/Install+Sonar#InstallSonar-The2minutestutorial 3. unzip example 4. run mvn -X clean install sonar:sonar => build fails with Caused by: org.sonar.api.resources.DuplicatedSourceException: test.TestMe at org.sonar.batch.index.SourcePersister.saveSource(SourcePersister.java:45) at org.sonar.batch.index.DefaultPersistenceManager.setSource(DefaultPersistenceManager.java:78) at org.sonar.batch.index.DefaultIndex.setSource(DefaultIndex.java:411) at org.sonar.batch.DefaultSensorContext.saveSource(DefaultSensorContext.java:159) at org.sonar.plugins.squid.JavaSourceImporter.importSource(JavaSourceImporter.java:83) ... 39 more [ERROR] [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
http://git.eclipse.org/c/tycho/org.eclipse.tycho.git/commit/?id=3763574b3312863df55ec2dc9e054130ed81a39f