SonarQube Runner
  1. SonarQube Runner
  2. SONARUNNER-1

Create a Sonar Standalone Runner (In addition to the Maven & Ant Runners)

    Details

    • Type: New Feature New Feature
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.0
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      0

      Description

      A project analysis should be started from an independent Java program, outside build tools like maven or ant. For example :

      java -jar sonar-batch.jar my-project.properties
      

      The first parameter is the location of the project configuration file. It defines metadata like source and binary directories, project key, language or name.

      project.key=my:project
      project.name=My project
      project.version=1.0
      project.sources=src/main/java
      project.sources=src/main/resources
      project.binaries=output/classes
      project.language=java
      sonar.dynamicAnalysis=reuseReports
      sonar.surefire.reports=output/junit/
      

      Parameters can also be defined from command-line :

      java -jar sonar-batch.jar my-project.properties -Dsonar.host.url=http://localhost:9000 -Dsonar.jdbc.url=jdbc:derby://localhost:1527/sonar
      

      The main JAR contains the bootstrapper. It downloads batch and plugin libraries from server.

        Issue Links

          Activity

          Hide
          Evgeny Mandrikov added a comment - - edited

          Couple of notes (after investigations made for SONAR-1514) about how this program should start execution :

          1. Main method should use SONAR-2106 to create ClassLoader with sonar-batch and its dependencies
          2. Execution should be transferred to other class with main method, but which was loaded by new ClassLoader
          3. And now this class can create ProjectDefinition using sonar-plugin-api and invoke sonar-batch


          So in final JAR we will include only bootstrapper.
          I believe that this technique flexible enough and can be used not only by Ant and Java program, but also by other build-tools. But I'm not sure about IDEs.

          Show
          Evgeny Mandrikov added a comment - - edited Couple of notes (after investigations made for SONAR-1514 ) about how this program should start execution : Main method should use SONAR-2106 to create ClassLoader with sonar-batch and its dependencies Execution should be transferred to other class with main method, but which was loaded by new ClassLoader And now this class can create ProjectDefinition using sonar-plugin-api and invoke sonar-batch So in final JAR we will include only bootstrapper. I believe that this technique flexible enough and can be used not only by Ant and Java program, but also by other build-tools. But I'm not sure about IDEs.
          Hide
          Freddy Mallet added a comment -

          For a user point of view, I expect to :

          • Download and Unzip an archive
          • Define a SONAR_RUNNER_HOME environment variable
          • Add $ {SONAR_RUNNER_HOME}/bin to my PATH
            * Find and update a ${SONAR_RUNNER_HOME}

            /conf/sonar-runner.properties. This file should contain the global properties like sonar.host.url.

          • And then being able to launch the "sonar" command from anywhere. Without additional information, the "sonar" command should expect to find a sonar-project.properties in the current directory to get information about the project to analyse.
          Show
          Freddy Mallet added a comment - For a user point of view, I expect to : Download and Unzip an archive Define a SONAR_RUNNER_HOME environment variable Add $ {SONAR_RUNNER_HOME}/bin to my PATH * Find and update a ${SONAR_RUNNER_HOME} /conf/sonar-runner.properties. This file should contain the global properties like sonar.host.url. And then being able to launch the "sonar" command from anywhere. Without additional information, the "sonar" command should expect to find a sonar-project.properties in the current directory to get information about the project to analyse.

            People

            • Assignee:
              Evgeny Mandrikov
              Reporter:
              Simon Brandhof
            • Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: