GithubHelp home page GithubHelp logo

tedb19 / sonarqube-maven-example Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 4.0 124 KB

Sonarqube is an invaluable tool for static code analysis and monitoring test coverage. This example demonstrates how to analyze a simple Java Maven project.

Java 100.00%

sonarqube-maven-example's Introduction

Maven Project Code Analysis With Sonarqube:

Sonarqube is an invaluable tool for static code analysis and monitoring test coverage. This example demonstrates how to analyze a simple Java Maven project.

Prerequisites

  • SonarQube 2.12 or higher
  • Maven 3.3.1 or higher

Installation:

  • Create an empty schema called sonar and a sonarqube user, with db_owner (CRUD) permission on this db (MS SQL is so nice on this)

  • Edit conf/sonar.properties, and set the following:

    VARIABLE ROLE EXAMPLE VALUES
    sonar.jdbc.username The sonar database username sonar
    sonar.jdbc.password The sonar database password s3cr3t1234
    sonar.jdbc.url The sonar database url jdbc:jtds:sqlserver://localhost/sonar;SelectMethod=Cursor
    sonar.web.context Web context. When set, it must start with forward slash (for example /sonarqube). /sonar
    sonar.web.port TCP port for incoming HTTP connections. 9000
  • Run StartSonar.bat on the cmd to test

  • Go to localhost:9000/sonar

  • If everything is ok, run InstallNTService.bat to install sonarqube as a service

Running analysis on a maven project:

  • Copy the settings.xml file to your .m2 folder(see link for details)

  • Copy the sonar-specific details on the pom file to your pom file

  • Each time you make a change to your maven project, run:

    mvn clean org.jacoco:jacoco-maven-plugin:0.7.4.201502262128:prepare-agent install

    This cleans, builds, tests, downloads jacoco, and runs the "prepare-agent" goal, packages then installs PS: 0.7.4.201502262128 is the jacoco version number

  • Run: mvn sonar:sonar [This updates the sonar db]

  • Refresh localhost:9000/sonar

sonarqube-maven-example's People

Contributors

tedb19 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.