SonarQube Plugins
  1. SonarQube Plugins
  2. SONARPLUGINS-1618

The sonar-runner.bat launcher for windows does not allow us to forward more than one Sonar options in command-line argument

    Details

    • Number of attachments :
      1

      Description

      Since the sonar-runner.bat launcher for windows:

      • Does not allow us to forward more than one Sonar options in command-line argument.
      • Forces us to call it from within the same directory where stands the sonar-project.properties file.
      • Does not allow us to forward the verbose mode in command-line argument.

      I've decided to develop a sonar-runner-advanced.bat which answers to all those needs. I think it may worth to replace your sonar-runner.bat content with this new launcher script content.

      Hope this help.


      Thomas PIERRAIN (thomas@pierrain.net)

      --------------------------------------------------------
      FYI: Here is the man of the sonar-runner-advanced.bat
      --------------------------

      C:\>sonar-runner-advanced /h

      Advanced Sonar Runner Startup Script for Windows v1.1

      Allows you to forward all the sonar options you want through the command-line arguments,
      but also to launch your sonar analysis wherever you want (i.e. you are not forced to call
      it within the directory where your project stands).
      Last but not least, the advanced sonar runner will allow you to enable the verbose mode
      for your sonar analysis.

      Usage: sonar-runner-advanced [/v] [/p project-home-dir] [/o sonar-option1 sonar-option2 ...]

      Options:
      /v Enable the verbose mode

      /p project-home-dir Set the directory of the project to analyse (should not have a backslash at the end).
      The current directory will be used if no value is specified.
      e.g. /p "C:\Dev\WorkingDir\trunk\MyProject\Src"

      /o sonar-options Set the sonar options for the sonnar runner to be used
      e.g. /o "-Dsonar.projectVersion=0.18" "-Dsonar.jdbc.driver=org.apache.derby.jdbc.ClientDriver"

      Example:
      sonar-runner-advanced /v /p "C:\Dev\WorkingDir\trunk\MyProject\Src" /o "-Dsonar.projectVersion=1.3" "-Dsonar.jdbc.driver=org.apach
      e.derby.jdbc.ClientDriver" "-Dsonar.jdbc.url=jdbc:derby://MySonarServerName:1527/sonar;create=true" "-Dsonar.jdbc.username=sonar"
      "-Dsonar.jdbc.password=sonar" "-Dsonar.host.url=http://MySonarServerName:9000/"

      C:\>

        Activity

        Hide
        Evgeny Mandrikov added a comment -

        For the record - discussion in ML : http://markmail.org/message/dltpfqeyt7u7xabf

        Show
        Evgeny Mandrikov added a comment - For the record - discussion in ML : http://markmail.org/message/dltpfqeyt7u7xabf
        Hide
        Evgeny Mandrikov added a comment -

        Hi Thomas,
        Could you please provide log which demonstrates that you can't use more than one option?

        Show
        Evgeny Mandrikov added a comment - Hi Thomas, Could you please provide log which demonstrates that you can't use more than one option?
        Hide
        Fabrice Bellingard added a comment -

        Fom what I've just tested:

        • extra options (-Dxxx=yyyy) are perfectly passed to the Java Runner
        • this implies that it is also the case for the '-X' option
          • so no need for a '/v' switch
        • this also removes the need of a '/p' switch to specify the project home folder as this is possible through the '-Dproject.home=xxx" option
          • for this case, I will document it on the Wiki

        So to sum up, it seems to me that the current script perfectly meets the needs.

        Show
        Fabrice Bellingard added a comment - Fom what I've just tested: extra options (-Dxxx=yyyy) are perfectly passed to the Java Runner this implies that it is also the case for the '-X' option so no need for a '/v' switch this also removes the need of a '/p' switch to specify the project home folder as this is possible through the '-Dproject.home=xxx" option for this case, I will document it on the Wiki So to sum up, it seems to me that the current script perfectly meets the needs.
        Hide
        Fabrice Bellingard added a comment -

        Wiki documentation improved for advanced properties.

        Show
        Fabrice Bellingard added a comment - Wiki documentation improved for advanced properties.
        Hide
        Evgeny Mandrikov added a comment -

        Fabrice, FYI I had the same feeling, when this ticket was created

        Show
        Evgeny Mandrikov added a comment - Fabrice, FYI I had the same feeling, when this ticket was created
        Hide
        Thomas PIERRAIN added a comment -

        Evgeny,

        Instead of having "feelings", could you please indicate us what should be the exact 'windows command line' that will successfully call your sonar-runner.bat (v 1.2) with at least options such as:

        sonar.projectVersion=1.3
        sonar.jdbc.driver=org.apache.derby.jdbc.ClientDriver
        sonar.jdbc.url=jdbc:derby://127.0.0.1:1527/sonar;create=true
        sonar.jdbc.username=sonar
        sonar.jdbc.password=sonar
        sonar.host.url=http://127.0.0.1:9000/

        I can't stand waiting to try your answer...

        Show
        Thomas PIERRAIN added a comment - Evgeny, Instead of having "feelings", could you please indicate us what should be the exact 'windows command line' that will successfully call your sonar-runner.bat (v 1.2) with at least options such as: sonar.projectVersion=1.3 sonar.jdbc.driver=org.apache.derby.jdbc.ClientDriver sonar.jdbc.url=jdbc:derby://127.0.0.1:1527/sonar;create=true sonar.jdbc.username=sonar sonar.jdbc.password=sonar sonar.host.url= http://127.0.0.1:9000/ I can't stand waiting to try your answer...
        Hide
        Evgeny Mandrikov added a comment -

        I don't have Windows right now to test, but I guess that following command will work:

        sonar-runner.bat "-Dsonar.projectVersion=1.3" "-Dsonar.jdbc.driver=org.apache.derby.jdbc.ClientDriver" "-Dsonar.jdbc.url=jdbc:derby://127.0.0.1:1527/sonar;create=true" "-Dsonar.jdbc.username=sonar" "-Dsonar.jdbc.password=sonar" "-Dsonar.host.url=http://127.0.0.1:9000/"
        

        However should be noted that all values except of projectVersion already set as defaults, so might be omitted.

        Show
        Evgeny Mandrikov added a comment - I don't have Windows right now to test, but I guess that following command will work: sonar-runner.bat "-Dsonar.projectVersion=1.3" "-Dsonar.jdbc.driver=org.apache.derby.jdbc.ClientDriver" "-Dsonar.jdbc.url=jdbc:derby://127.0.0.1:1527/sonar;create=true" "-Dsonar.jdbc.username=sonar" "-Dsonar.jdbc.password=sonar" "-Dsonar.host.url=http://127.0.0.1:9000/" However should be noted that all values except of projectVersion already set as defaults, so might be omitted.
        Hide
        Freddy Mallet added a comment -

        Manually tested !

        Show
        Freddy Mallet added a comment - Manually tested !
        Hide
        Fabrice Bellingard added a comment -

        No need for IT.

        Show
        Fabrice Bellingard added a comment - No need for IT.

          People

          • Assignee:
            Fabrice Bellingard
            Reporter:
            Thomas PIERRAIN
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: