Search code examples
javaintellij-ideasonarqubemaven-3sonarlint

Unresolved org.codehaus.mojo:sonar-maven-plugin:3.0.1 Intellij - Maven Project


I'm using Intellij IDEA 2016.1 working in an imported Maven project. Intellij complains only about sonar-maven-plugin.

I have already tried to reimport in maven option but Intellij stills mad with this plugin.

The error message in Intellij is: Unresolved plugin org.codehaus.mojo:sonar-maven-plugin:3.0.1

enter image description here

Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T09:41:47-07:00)   
Maven home: /usr/local/apache-maven-3.3.9   
Java version: 1.8.0_92, vendor: Oracle Corporation   
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8     
OS name: "mac os x", version: "10.11.5", arch: "x86_64", family: "mac"

Solution

  • That's because the artifact with Maven coordinates org.codehaus.mojo:sonar-maven-plugin:3.0.1 is a pom file in Maven Central and not a jar, so it cannot be resolved properly.

    The latest official version of the plugin using these coordinates is 2.7.1

    The sonar-maven-plugin has changed then coordinates, moving to a new groupId: org.sonarsource.scanner.maven, which indeed provides the 3.0.1 version.

    You should hence change the existing coordinates used by your pom.xml file to:

    <groupId>org.sonarsource.scanner.maven</groupId>
    <artifactId>sonar-maven-plugin</artifactId>
    <version>3.0.1</version>
    

    That's also documented on the official Sonarqube Maven documentation.