Failed to execute Scanner Maven: 'Please provide compiled classes' error

-Jenkins 2.89.4
-java-8 version
-SonarQube Scanner 3.2.0 (plugin installed in Jenkins)

I’m tring to configure Jenkins jobs to run analysis (Maven project)
-I’ve created a free style project that contains steps and post-build action
To configure Jenkins job,

  • Build Environment, I checked “Prepare SonarQube Scanner environment”
    -For the build, i choosed invoke top-level Maven target:
    Maven Version default
    POM: path/pom.xlm

But, when i build my project, i have the following message:

I would like to ask if i add a plugin to pom.xml (Maven), witch version should i use?
thank you in advance


First, the post-build step has long since been deprecated. Plus, it doesn’t use the environment variables that are exposed when you turn on ‘Prepare SonarQube Scanner environment’. Instead, you should be using a normal Maven step at the end of your build, as documented.

All that said, this should work anyway if you actually build your project first. But the error message indicates that you don’t:

Please provide compiled classes of your project with property


1 Like

Hi Ann,
Thank you for your reply
I need please more clarifications
I followed the document that you gave me
what I understood by “provide compiled classes of your project with property”
I added in my porm.xml this plugin:

org.codehaus.mojo sonar-maven-plugin

in the settings.xml for my maven configurations (i’m going to C:\apache-maven-3.5.4\conf\setting.xml) with this content

                <!-- Optional URL to server. Default value is http://localhost:9000 -->

I want to know if I’m on the right way.


You don’t need to do anything to your pom. You just need to make sure you compile before you analyze. Once you do, Maven will automatically know where your binaries are, and the SonarQube Scanner for Maven (invoked by the Maven build step you’re going to add at the end of your build with a command of sonar:sonar) will naturally know where to look.


1 Like