Discussion:
Need clarification on the Inclusion\exclusion pattern
Lakshmi
2014-07-30 09:02:38 UTC
Permalink
Hi,

For few projects, I get the following error -

Filename.java cant be indexed twice. Please check that inclusion\exclusion
patterns produce disjoint set for main and test files.

Caused by MojoExecutionException.

How should I resolve the error?







-----
Thanks,
Lakshmi
--
View this message in context: http://sonarqube.15.x6.nabble.com/Need-clarification-on-the-Inclusion-exclusion-pattern-tp5026971.html
Sent from the SonarQube Users mailing list archive at Nabble.com.
Julien HENRY
2014-07-30 09:55:15 UTC
Permalink
Hi,

What are you version of SQ and SQ Maven plugin?

Are you using standard default or are your overriding sonar.sources and
sonar.tests?

Please provide logs of the failing analysis.

++

Julien
Post by Lakshmi
Hi,
For few projects, I get the following error -
Filename.java cant be indexed twice. Please check that inclusion\exclusion
patterns produce disjoint set for main and test files.
Caused by MojoExecutionException.
How should I resolve the error?
-----
Thanks,
Lakshmi
--
http://sonarqube.15.x6.nabble.com/Need-clarification-on-the-Inclusion-exclusion-pattern-tp5026971.html
Sent from the SonarQube Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
Lakshmi
2014-07-31 03:38:55 UTC
Permalink
Hi Julien,

I'm using SQ V4.3 & SQ Maven plugin v2.3.

I'm using maven analysis for the maven project. So I have added only
sonar.sources in pom.xml which will point to the root project directory.

Attached failing analysis. Please check.

AnalysisLog.txt
<http://sonarqube.15.x6.nabble.com/file/n5027000/AnalysisLog.txt>



-----
Thanks,
Lakshmi
--
View this message in context: http://sonarqube.15.x6.nabble.com/Need-clarification-on-the-Inclusion-exclusion-pattern-tp5026971p5027000.html
Sent from the SonarQube Users mailing list archive at Nabble.com.
Julien HENRY
2014-07-31 07:51:22 UTC
Permalink
Hi Lakshmi,

By default Maven plugin will set:
sonar.sources=src/main/java
sonar.tests=src/test/java

Since you have overriden sonar.sources to be "." then indeed test files are
indexed twice (once as "main" code and once as "test").

If you really need to set sonar.sources=. then you need to also exclude
test directory:
sonar.exclusions=src/test/java/**

++

Julien
Post by Lakshmi
Hi Julien,
I'm using SQ V4.3 & SQ Maven plugin v2.3.
I'm using maven analysis for the maven project. So I have added only
sonar.sources in pom.xml which will point to the root project directory.
Attached failing analysis. Please check.
AnalysisLog.txt
<http://sonarqube.15.x6.nabble.com/file/n5027000/AnalysisLog.txt>
-----
Thanks,
Lakshmi
--
http://sonarqube.15.x6.nabble.com/Need-clarification-on-the-Inclusion-exclusion-pattern-tp5026971p5027000.html
Sent from the SonarQube Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
Lakshmi
2014-07-31 09:00:42 UTC
Permalink
Hi Julien,

Could you please correct my pom.xml?

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>com.xyz.com</groupId>
<artifactId>mytest</artifactId>
<name>mytest</name>
<version>1.3</version>
<packaging>jar</packaging>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<sonar.sources>C:\workspace_ICOMPLIANCE\mytest</sonar.sources>
</properties>

<prerequisites>
<maven>3.0.4</maven>
</prerequisites>
</project>



-----
Thanks,
Lakshmi
--
View this message in context: http://sonarqube.15.x6.nabble.com/Need-clarification-on-the-Inclusion-exclusion-pattern-tp5026971p5027016.html
Sent from the SonarQube Users mailing list archive at Nabble.com.
Julien HENRY
2014-07-31 09:14:16 UTC
Permalink
Post by Lakshmi
<sonar.sources>C:\workspace_ICOMPLIANCE\mytest</sonar.sources>
and see how it goes. Using absolute path will not make your project very
portable...
Lakshmi
2014-07-31 10:17:29 UTC
Permalink
Hi Julien,

Dropping the entire sonar.sources tag makes the project build success but I
want to analyze multi-language project. JS & JSP files under
\mytest\src\main\webapp gets ignored in the scan.

Please suggest how to scan for multi language?




-----
Thanks,
Lakshmi
--
View this message in context: http://sonarqube.15.x6.nabble.com/Need-clarification-on-the-Inclusion-exclusion-pattern-tp5026971p5027021.html
Sent from the SonarQube Users mailing list archive at Nabble.com.
Julien HENRY
2014-07-31 12:07:08 UTC
Permalink
Hi,

src/main/webapp should already been automatically added to sonar.sources
for war projects. You just have to use latest version of the SQ Maven
Plugin.

Other option is to define sonar.sources=src/main/java,src/main/webapp, or
sonar.sources=src/main
Post by Lakshmi
Hi Julien,
Dropping the entire sonar.sources tag makes the project build success but I
want to analyze multi-language project. JS & JSP files under
\mytest\src\main\webapp gets ignored in the scan.
Please suggest how to scan for multi language?
-----
Thanks,
Lakshmi
--
http://sonarqube.15.x6.nabble.com/Need-clarification-on-the-Inclusion-exclusion-pattern-tp5026971p5027021.html
Sent from the SonarQube Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
Loading...