Uploaded image for project: 'SonarQube Plugins'
  1. SonarQube Plugins
  2. SONARPLUGINS-1122

Changelog extractor uses path to Sonar project configuration file

    Details

      Description

      It looks like the 'Retrieve changelog' is based on the path to the Sonar configuration file (which is a pom when Maven is used) given with the build. This leads to an error for instance if the pom is generated and therefor not under scm control.

      [1.0.0] $ mvn -f prj/build/sonar/pom.xml ... -e -B sonar:sonar
      ....
      [INFO]  Retrieve changelog from revision 1...
      [INFO]  It can be long this first time. Next analysis will be faster.
      [INFO]  	Executing: /bin/sh -c cd /export/build/hudson/jobs/prj-1.0.0/workspace/1.0.0/prj/build/sonar && svn --username foo --password '*****' --no-auth-cache --non-interactive --trust-server-cert log -v -r 1:BASE
      [INFO]  	Working directory: /export/build/hudson/jobs/prj-1.0.0/workspace/1.0.0/prj/build/sonar
      [INFO]  Retrieve changelog from revision 1 done: 31 ms
      [INFO] ------------------------------------------------------------------------
      [ERROR] BUILD ERROR
      [INFO] ------------------------------------------------------------------------
      [INFO] Can not execute Sonar
      
      Embedded error: Unable to retrieve changelog: svn: '.' is not a working copy
      [INFO] ------------------------------------------------------------------------
      [INFO] Trace
      org.apache.maven.lifecycle.LifecycleExecutionException: Can not execute Sonar
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:284)
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
      	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
      	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
      	at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
      	at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:585)
      	at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
      	at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
      	at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
      	at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
      Caused by: org.apache.maven.plugin.MojoExecutionException: Can not execute Sonar
      	at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:103)
      	at org.codehaus.mojo.sonar.Bootstraper.start(Bootstraper.java:79)
      	at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:88)
      	at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
      	... 17 more
      Caused by: org.sonar.api.utils.SonarException: Unable to retrieve changelog: svn: '.' is not a working copy
      
      	at org.sonar.plugins.scmactivity.Changelog.retrieveChangeSets(Changelog.java:105)
      	at org.sonar.plugins.scmactivity.Changelog.load(Changelog.java:55)
      	at org.sonar.plugins.scmactivity.ScmActivitySensor.analyse(ScmActivitySensor.java:83)
      	at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:59)
      	at org.sonar.batch.phases.Phases.execute(Phases.java:75)
      	at org.sonar.batch.ProjectBatch.execute(ProjectBatch.java:55)
      	at org.sonar.batch.Batch.analyzeModule(Batch.java:158)
      	at org.sonar.batch.Batch.analyzeModules(Batch.java:76)
      	at org.sonar.batch.Batch.execute(Batch.java:62)
      	at org.sonar.maven.SonarMojo.executeBatch(SonarMojo.java:151)
      	at org.sonar.maven.SonarMojo.execute(SonarMojo.java:142)
      	at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
      	at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:98)
      	... 21 more
      

      This extractor should be able to work with the scm connection url in such case or with another additional provided root directory.

        Issue Links

          Activity

          Hide
          amandel Andreas Mandel added a comment -

          Hmmm, that would completely change the way we integrate our builds with Sonar - this is currently not an option. We based the integration on the Sonar Jenkins Plugin.

          How is the

          {base directory}

          determined if the ant task is used? I could not see this in the definition of the ant task. Might be a similiar way could be used here?

          Show
          amandel Andreas Mandel added a comment - Hmmm, that would completely change the way we integrate our builds with Sonar - this is currently not an option. We based the integration on the Sonar Jenkins Plugin . How is the {base directory} determined if the ant task is used? I could not see this in the definition of the ant task. Might be a similiar way could be used here?
          Hide
          freddy.mallet Freddy Mallet added a comment -

          This would be very similar to what you get with Maven : the svn changelog command would be launch from where your Ant build script is located (but in that case, I guess that your ant build script would be located at the root of your project).

          Show
          freddy.mallet Freddy Mallet added a comment - This would be very similar to what you get with Maven : the svn changelog command would be launch from where your Ant build script is located (but in that case, I guess that your ant build script would be located at the root of your project).
          Hide
          amandel Andreas Mandel added a comment -

          I looks like the implied values do not fit in our case. The only solution I see is to provide a property sonar.projectBasePath that overrides the otherwise implied base directory.

          Show
          amandel Andreas Mandel added a comment - I looks like the implied values do not fit in our case. The only solution I see is to provide a property sonar.projectBasePath that overrides the otherwise implied base directory .
          Hide
          freddy.mallet Freddy Mallet added a comment -

          Interesting idea that could solve another issue that we have on the C plugin (http://jira.sonarsource.com/browse/CANSI-72).

          Show
          freddy.mallet Freddy Mallet added a comment - Interesting idea that could solve another issue that we have on the C plugin ( http://jira.sonarsource.com/browse/CANSI-72 ).
          Hide
          dgageot David Gageot added a comment -

          With version 1.4 of the plugin, we don't load the changesets anymore

          Show
          dgageot David Gageot added a comment - With version 1.4 of the plugin, we don't load the changesets anymore

            People

            • Assignee:
              dgageot David Gageot
              Reporter:
              amandel Andreas Mandel
            • Votes:
              6 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: