Maven scanner and sonar.branch error

Hello all, brand new to sonarqube, evaluating community edition for the first time.

I’m using the latest sonarqube 9.4 server and trying to get my first maven scanner to work. I just followed the documented example for settings.xml.

The old project I have requires java 1.8. So I’ve set JAVA_HOME to the required java and do the usual:
mvn clean install
which works fine. I then switch JAVA_HOME to java 11 and try:
mvn sonar:sonar -Dsonar.login=[api key]

I end up with an error similar to:
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin: (default-cli) on project apps: The ‘sonar.branch’ parameter is no longer supported.

I’m using community edition, and I haven’t tried to set any special options like sonar.branch. If it matters I’m using maven 3.6.3 and had a stock settings.xml which I only added in the maven scanner info as per the documentation. I have no need for branch analysis right now. The directory I run the build from has no .git information, so I’ve no idea where or why it is trying to set sonar.branch.

Any thoughts?

Thanks for the help

Hey there.

Is it possible that sonar.branch is lingering in your project’s pom.xml file?

Thanks, I think you pointed out the obvious to me, something I didn’t realize …

Looks like this project I am working on had some sonarqube work done 8-10 yrs ago, and there are very old sonar stuff peppered all over the place … I had no idea.

In this case, the pom.xml file one directory level up had the offending sonar.branch statement.

Thanks! Simple answer but you saved my sanity …

1 Like