Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-7105

Sonar plugin does not resolve "alternate settings file" correctly for Maven project


    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • sonar-plugin
    • None

      The Sonar plugin does not resolve the alternate settings file configured for a Maven project properly.

      I configured my Maven project with an "Alternate settings file" in the "Build" section. When the Sonar part of the build runs, it says that the settings file is invalid. I believe this is because it does not resolve the path to the settings file as the Maven build does (relative to the workspace) and so it cannot find the file.

      Here is how the Maven build resolves the settings file called CRSReservationService-settings.xml:

      Executing Maven: -B -f /common/build/sdkhudsonhome/.hudson/jobs/CRSReservationService-trunk-sonar/workspace/trunk/pom.xml -s /common/build/sdkhudsonhome/.hudson/jobs/CRSReservationService-trunk-sonar/workspace/trunk/etc/hudson/CRSReservationService-settings.xml clean install

      Here is how the Sonar part of the build tries to resolve it (as you can see, it uses a relative path and so is not correct):

      [trunk] $ /common/build/tools/maven/apache-maven-2.0.10/bin/mvn -f pom.xml -s trunk/etc/hudson/CRSReservationService-settings.xml -e -B sonar:sonar -Dsonar.jdbc.driver=oracle.jdbc.driver.OracleDriver -Dsonar.jdbc.url=jdbc:oracle:thin:@server:0000:DB ******** ******** -Dsonar.host.url=http://localhost:8080/sonar/ -Dsonar.branch=trunk
      + Error stacktraces are turned on.
      WARNING: Alternate user settings file: trunk/etc/hudson/CRSReservationService-settings.xml is invalid. Using default path.

            godin godin
            allenservedio allenservedio
            2 Vote for this issue
            2 Start watching this issue