Giter Site home page Giter Site logo

barrieshieh / sonar-oss-scanner-maven-plugin Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 74 KB

Maven plugin for scanning source code with combination of dependency-check, checkstyle, spotbugs, pmd and generate reports for SonarQube

License: Apache License 2.0

Groovy 14.34% Java 85.66%
oss maven sonar sonarqube plugin dependency-check checkstyle spotbugs pmd

sonar-oss-scanner-maven-plugin's Introduction

This plugin will scan the code with source code with dependency-check, checkstyle, spotbugs, pmd and generate reports for SonarQube

Embedded scanner

This scanner is embedded with following scanner by default

Embedded Plugin name Embedded Plugin version Description
dependency-check-maven 6.1.0
maven-checkstyle-plugin 3.1.2 With Google Java Style
spotbugs-maven-plugin 4.2.0 With findsecbugs(LATEST), sb-contrib(LATEST)
maven-pmd-plugin 3.14.0

Example Usage

How to use this plugin in the project

# Build the project
mvn clean compile package
# Generate the reports
mvn oss:scan
# Do the sonar scan
mvn sonar:sonar

SonarQube properties

<properties>
    <sonar.dependencyCheck.jsonReportPath>${project.build.directory}/dependency-check-report.json</sonar.dependencyCheck.jsonReportPath>
    <sonar.dependencyCheck.htmlReportPath>${project.build.directory}/dependency-check-report.html</sonar.dependencyCheck.htmlReportPath>
    <sonar.dependencyCheck.xmlReportPath>${project.build.directory}/dependency-check-report.xml</sonar.dependencyCheck.xmlReportPath>
    <sonar.java.checkstyle.reportPaths>${project.build.directory}/checkstyle-result.xml</sonar.java.checkstyle.reportPaths>
    <sonar.java.spotbugs.reportPaths>${project.build.directory}/spotbugsXml.xml</sonar.java.spotbugs.reportPaths>
    <sonar.java.pmd.reportPaths>${project.build.directory}/pmd.xml</sonar.java.pmd.reportPaths>
</properties>

Maven Dependency

NOTE: This plugin is not in the central maven yet. You need to use mvn install to add it to local repository.

Add this to your pom.xml:

<plugin>
    <groupId>org.twdata.maven</groupId>
    <artifactId>sonar-oss-scanner-plugin</artifactId>
    <version>1.0.5</version>
</plugin>

Parameter configLocation is optional. You can specify the absolute path for the external plugin configurations.

<plugin>
    <groupId>org.twdata.maven</groupId>
    <artifactId>sonar-oss-scanner-plugin</artifactId>
    <version>1.0.5</version>
    <configuration>
        <configLocation>
          C:/plugins.xml
        </configLocation>
    </configuration>
</plugin>

You can add more analyzer to the plugins.xml with following format

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <plugins>
        <plugin>
            <goal>${goal}</goal>
            <plugin>
                <groupId>${groupId}</groupId>
                <artifactId>${artifactId}</artifactId>
                <version>${version}</version>
            </plugin>
            <configuration>
                ...
                ${pluginConfiguration}
            </configuration>
        </plugin>
    </plugins>
</configuration>

License

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Apache License, Version 2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Contributors

mojo-executor

sonarqube-licensecheck

checkstyle

spotbugs

pmd

mojo-api

sonar-oss-scanner-maven-plugin's People

Contributors

barrie-xie avatar barrieshieh avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.