Sonar `should be relative to project baseDir` error in travis

Viewed 3896

Some time between the 11th September and the 14th September, running sonar through our travis build started failing with an org.eclipse.dawnsci.targetplatform should be relative to project baseDir error:

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.3.0.603:sonar (default-cli) on project org.eclipse.scanning: Dir /home/travis/build/eclipse/org.eclipse.dawnsci/org.eclipse.dawnsci.targetplatform should be relative to project baseDir -> [Help 1]

Looking through the pom.xml the org.eclipse.dawnsci module does stand out as being different to all of the others:

  <modules>
    <module>org.eclipse.scanning.target.platform</module>
    <module>../org.eclipse.dawnsci</module>
    <module>org.eclipse.scanning.api</module>
    ...
  </modules>

I have tried updating sonar-project.properties from

sonar.exclusions=**/*.xml,**/*.class

to each of the following:

sonar.exclusions=**/*.xml,**/*.class,../org.eclipse.dawnsci
sonar.exclusions=**/*.xml,**/*.class,org.eclipse.dawnsci*
sonar.exclusions=**/*.xml,**/*.class,org.eclipse.dawnsci**

but none of these changes helped.

After previous problems I have added --fail-never to the mvn -q sonar:sonar command in .travis.yml so this problem won't prevent pull requests being merged, but it would be nice to have sonar reports on our repo again.

Any suggestions about how I can fix our travis build would be appreciated?

3 Answers

As suggested by Julien H. - SonarSource Team adding a profile did solve this problem.

In the pom.xml I changed

<modules>
    <module>org.eclipse.scanning.target.platform</module>
    <module>../org.eclipse.dawnsci</module>
    ...
</modules>

to

<profiles>
    <profile>
        <id>externalModules</id>
        <activation><activeByDefault>true</activeByDefault></activation>
        <modules>
            <module>../org.eclipse.dawnsci</module>
        </modules>
    </profile>
</profiles>

<modules>
    <module>org.eclipse.scanning.target.platform</module>
    ...
</modules>

so that the module is included by default.

I then added -P !externalModules to my mvn sonar:sonar command in .travis.yml so that it was excluded when running sonar analysis.

Related