Sonarqube exclude plugin while scanning Maven project

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension) 7.9.4 LTS Enterprise version
  • what are you trying to achieve scanning
  • what have you tried so far to achieve this – scanning issues while using Jenkins

The requirement is to exclude a plugin from picking up while scanning, the project team mentioned they don’t need MULESOFT PLUGIN and they need to exclude them on their pom.xml.

But we were not able to provide him a example piece of code which can exclude this MULESOFT plugin from their scan.

Their project needs Java 1.8 compiler and they cannot move to java11 in neartime. Below is the error, if you need more information, let me know we can provide it.

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin: (default-cli) on project XXXX: The plugin [mulesoft] does not support Java 1.8.0_252: com/ultimatesoftware/sonar/plugins/mulesoft/MulesoftPlugin has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0 -> [Help 1]


[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.

[ERROR] Re-run Maven using the -X switch to enable full debug logging.


[ERROR] For more information about the errors and possible solutions, please read the following articles:

[ERROR] [Help 1]


You’re mixing 2 different things here:

  • The version of Java to run the Scanner (and all the plugins). Except for some 3rd party plugins that may require Java 11, the SonarScanner and the SonarSource plugins do support Java 8.
  • The version of Java to build your project

If you run a single mvn command it’s a bit difficult to distinguish the 2, but if you do it in 2 steps it’s quite easy to use a different Jav for the build phase and the scanner phase. Simply run:

# Select the JDK 8 you need (by setting JAVA_HOME or whatever other method
# eg: export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home"

# Run the build (clean package or whatever other command you use)
mvn clean package

# Switch to JDK 11 (by setting JAVA_HOME or whatever other method)
# eg: export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk-11.0.3.jdk/Contents/Home/"
# Run the scanner
mvn sonar:sonar

Note: Support of Java 8 will not last for much longer in many tools, so I recommend strong to familiarize yourself with the above techniques. You will need that a lot if you still have code that requires Java 8 to compile


Can you please elobrate, where should we mention these steps on pom.xml or in build server or in jenkinsfile.

Hari Narayanan V

Hello Hari,

I will not elaborate much since this is not a SonarQube specific problem.
There are several ways to do it. I would recommend the Jenkinsfile.
Check out what Google points you at