maven - How to include JUnit tests in SONAR analysis -
i'm using sonarqube-5.0.1 manage code quality , maven build tool. when run mvn sonar:sonar doesn't consider test classes analysis. how can include test classes analysed in sonar.
my pom.xml given below
<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/xsd/maven-4.0.0.xsd"> <modelversion>x.x.x</modelversion> <groupid>com.xxxxxx.xxxxx</groupid> <artifactid>xxxx-xxxxxx</artifactid> <version>x.x.x</version> <properties> <project.build.sourceencoding>utf-8</project.build.sourceencoding> <maven.compiler.source>1.7</maven.compiler.source> <maven.compiler.target>1.7</maven.compiler.target> <slf4j.version>1.6.1</slf4j.version> <suitexmlfile>src/test/resources/junit.xml</suitexmlfile> <maven.source.classifier>src</maven.source.classifier> <maven.source.test.classifier>tests-src</maven.source.test.classifier> </properties> <build> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-surefire-plugin</artifactid> <version>2.18.1</version> <configuration> <suitexmlfiles> <suitexmlfile>${suitexmlfile}</suitexmlfile> </suitexmlfiles> </configuration> </plugin> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-project-info-reports-plugin</artifactid> <version>2.7</version> </plugin> <plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>cobertura-maven-plugin</artifactid> <version>2.6</version> <configuration> <formats> <format>html</format> <format>xml</format> </formats> </configuration> </plugin> <!-- make jars --> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-jar-plugin</artifactid> <version>2.6</version> <configuration> <excludes> <exclude>**/*.properties</exclude> <exclude>**/*.txt</exclude> <exclude>**/*.xml</exclude> <exclude>**/*.xsd</exclude> <exclude>**/*schema*</exclude> </excludes> <archive> <manifest> <addclasspath>true</addclasspath> <classpathprefix>dependency-jars/</classpathprefix> </manifest> <addmavendescriptor>false</addmavendescriptor> </archive> </configuration> <executions> <execution> <goals> <goal>jar</goal> <goal>test-jar</goal> </goals> </execution> </executions> </plugin> <!-- make source jar --> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-source-plugin</artifactid> <version>2.4</version> <configuration> <excludes> <exclude>**/*.properties</exclude> <exclude>**/*.txt</exclude> <exclude>**/*.xml</exclude> <exclude>**/*.xsd</exclude> <exclude>**/*schema*</exclude> </excludes> <includepom>true</includepom> </configuration> <executions> <execution> <goals> <goal>jar</goal> <goal>test-jar</goal> </goals> </execution> </executions> </plugin> <!-- make source javadocs --> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-javadoc-plugin</artifactid> <version>2.10.2</version> <configuration> <show>private</show> <reportoutputdirectory>${project.basedir}/docs</reportoutputdirectory> </configuration> </plugin> </plugins> </build> <!-- generate reports summary note: dependency management reports excluded--> <reporting> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-project-info-reports-plugin</artifactid> <version>2.7</version> <configuration> <dependencydetailsenabled>false</dependencydetailsenabled> <dependencylocationsenabled>false</dependencylocationsenabled> </configuration> <reportsets> <reportset> <reports> <report>cim</report> <report>distribution-management</report> <report>index</report> <report>issue-tracking</report> <report>license</report> <report>mailing-list</report> <report>modules</report> <report>plugin-management</report> <report>plugins</report> <report>project-team</report> <report>scm</report> <report>summary</report> </reports> </reportset> </reportsets> </plugin> </plugins> </reporting> <dependencies> <dependency> <groupid>org.apache.hadoop</groupid> <artifactid>hadoop-common</artifactid> <version>2.6.0</version> </dependency> <dependency> <groupid>org.apache.hadoop</groupid> <artifactid>hadoop-hdfs</artifactid> <version>2.6.0</version> </dependency> <dependency> <groupid>org.apache.hbase</groupid> <artifactid>hbase-hadoop-compat</artifactid> <version>0.98.9-hadoop2</version> <type>test-jar</type> <scope>test</scope> </dependency> <dependency> <groupid>org.apache.hbase</groupid> <artifactid>hbase-hadoop2-compat</artifactid> <version>0.98.9-hadoop2</version> <type>test-jar</type> <scope>test</scope> </dependency> <dependency> <groupid>org.apache.hbase</groupid> <artifactid>hbase-server</artifactid> <version>0.98.9-hadoop2</version> <type>test-jar</type> <scope>test</scope> </dependency> <dependency> <groupid>org.apache.hbase</groupid> <artifactid>hbase-common</artifactid> <version>0.98.9-hadoop2</version> <type>test-jar</type> <scope>test</scope> </dependency> <dependency> <groupid>org.apache.hbase</groupid> <artifactid>hbase-server</artifactid> <type>jar</type> <version>0.98.9-hadoop2</version> <scope>test</scope> </dependency> <dependency> <groupid>org.apache.hbase</groupid> <artifactid>hbase-client</artifactid> <version>0.98.9-hadoop2</version> </dependency> <dependency> <groupid>jdk.tools</groupid> <artifactid>jdk.tools</artifactid> <systempath>${env.java_home}/lib/tools.jar</systempath> <scope>system</scope> <version>1.7</version> </dependency> <dependency> <groupid>junit</groupid> <artifactid>junit</artifactid> <version>4.12</version> </dependency> <dependency> <groupid>org.testng</groupid> <artifactid>testng</artifactid> <version>6.8.8</version> <scope>test</scope> </dependency> <dependency> <groupid>org.powermock</groupid> <artifactid>powermock-module-junit4</artifactid> <version>1.6.2</version> </dependency> <dependency> <groupid>org.powermock</groupid> <artifactid>powermock-api-mockito</artifactid> <version>1.6.2</version> </dependency> </dependencies>
Comments
Post a Comment