Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tycho-user] from [sonar-user]: DuplicatedSourceException due to test folder added twice

I think a better (or the right?) solution here would be NOT to inject
duplicate source roots in Maven model. Having said that, we do need a
complete standalone example that demonstrates the problem to be sure.

--
Regards,
Igor

On 12-01-12 5:22 AM, Oberlies, Tobias wrote:
IIRC, it is possible to disable the use of the pde source roots in Tycho (usePdeSourceRoots). This could avoid this problem, but I don't know for sure.

Also, Igor was going to remove the switch (https://bugs.eclipse.org/bugs/show_bug.cgi?id=368083) for 0.14, so you should try this out now and comment on the bug if you need the switch.

Regards
Tobias



-----Original Message-----
From: tycho-user-bounces@xxxxxxxxxxx [mailto:tycho-user-
bounces@xxxxxxxxxxx] On Behalf Of Sievers, Jan
Sent: Donnerstag, 12. Januar 2012 11:16
To: Tycho user list
Subject: Re: [tycho-user] from [sonar-user]: DuplicatedSourceException due
to test folder added twice

the problem here is that tycho injects source folders from
build.properties back into the maven model as "compile roots" (as opposed
to "test compile roots").
This is needed for interoperability with non-OSGi aware maven plugins
(such as javadoc, PMD etc.).

In the following example this can lead to the "duplicated source" problem
with sonar:

in build.properties, you declare a source folder src/test/java/.
this is added to the maven model as "compile root".
However, the maven model also has a default "test compile root"
src/test/java.

Now if sonar scans all test and non-test compile roots of the maven model,
it will find the source files under src/test/java twice.

Not sure if tycho can do something about this. sonar could just as well
ignore duplicates.

workaround:

Either

1. don't use "src/test/java" in build.properties as this "collides" with
the maven model default value for test compile roots.

or

2. explicitly configure the test compile root to something different in
pom.xml

Regards
Jan



-----Original Message-----
From: tycho-user-bounces@xxxxxxxxxxx [mailto:tycho-user-
bounces@xxxxxxxxxxx] On Behalf Of Yves Langisch
Sent: Donnerstag, 12. Januar 2012 09:02
To: Tycho user list
Subject: [tycho-user] from [sonar-user]: DuplicatedSourceException due to
test folder added twice

Good morning,

Just switching over to the Tycho list as I'd like to get a statement
from you guys concerning this topic.

The main problem seems to be that the Maven test folders are also added
(additionally) to the normal source folders.

-
Yves

-------- Original Message --------
Subject: Re: [sonar-user] DuplicatedSourceException due to test folder
added twice
Date: Wed, 11 Jan 2012 13:17:21 +0100
From: Yves Langisch<yves@xxxxxxxxxxx>
Reply-To: user@xxxxxxxxxxxxxxxxxx
To: user@xxxxxxxxxxxxxxxxxx

Hmm, not sure but I think we talk at cross purposes ;)

IMHO the build.properties for the PDE build does not distinguish between
sources and tests. There is no such concept there. Where should your
configuration go?

This issue might be more related to the Tycho build maybe. During the
build process they control what is being added as source or test
folders. Not sure.

I know that it's a best practice to separate the tests in their own
bundle but this is currently possible in our project.

-
Yves

On 11.01.2012 12:57, Freddy Mallet wrote:
Hi Yves,

But why are you adding the test directories to the source folders ?

Your configuration should be :

|# path to source directories (required)|
|sources=|src/main/java
|# path to test source directories (optional)|
|tests=|src/test/java

Am I missing something ?
Freddy

-----
twitter.com/FreddyMallet<https://twitter.com/FreddyMallet>
Sonar for Continuous Inspection



On Wed, Jan 11, 2012 at 11:40 AM, Yves Langisch<yves@xxxxxxxxxxx
<mailto:yves@xxxxxxxxxxx>>  wrote:

     Hi,

     I have a RCP client which is being built with Tycho. Analyzing this
     project leads to DuplicatedSourceException in one module due to
     folders added twice (once as source directory, once as test
directory):

     [INFO] [11:27:15.288] Source directories:
     [INFO] [11:27:15.288]
     D:\workspace\mypropject\__client\mypropject-client\src\__main\java
     [INFO] [11:27:15.288]
     D:\workspace\mypropject\__client\mypropject-
client\src\__main\resources
     [INFO] [11:27:15.288]
     D:\workspace\mypropject\__client\mypropject-client\src\__test\java
     [INFO] [11:27:15.288]
     D:\workspace\mypropject\__client\mypropject-
client\src\__test\resources
     [INFO] [11:27:15.289] Test directories:
     [INFO] [11:27:15.290]
     D:\workspace\mypropject\__client\mypropject-client\src\__test\java

     IMHO this is caused by the build.properties which looks as follows:

     ...
     source.. = src/main/java/,\
                src/main/resources/,\
                src/test/java/,\
                src/test/resources/
     ...

     In order to be able to have all sources available in this project in
     Eclipse, this is a completely fine build.properties.

     sonar.exclusions can not help in this case.

     Any thoughts?
     Yves



     ------------------------------__------------------------------__----
-----
     To unsubscribe from this list, please visit:

     http://xircles.codehaus.org/__manage_email
     <http://xircles.codehaus.org/manage_email>





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

     http://xircles.codehaus.org/manage_email


_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/tycho-user
_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/tycho-user
_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/tycho-user


Back to the top