Search code examples
javamavenmaven-dependency

Maven Dependency jar for BuildPluginManager


In my maven plugin Mojo Java file, I am importing interface BuildPluginManager using following line:

import org.apache.maven.plugin.BuildPluginManager;

This line gives following error:

[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /Users/username/git/path/to/plugin/my-maven-plugin/src/main/java/com/company/product/repo/my_maven_plugin/ExecutorExampleMojo.java:[25,31] cannot find symbol
  symbol:   class BuildPluginManager
  location: package org.apache.maven.plugin
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE

Also, eclipse shows this error in the beginning of the file:

The type org.apache.maven.plugin.BuildPluginManager cannot be resolved. It is indirectly referenced from required .class files

From what I understand, it means that the dependency jar/war that has this interface BuildPluginManager is not there in the POM file. My question is, which dependency do I need to pull in to use this interface? How do I find that dependency?


Solution

  • You need to include dependency on org.apache.maven:maven-core:

    <dependency>
        <groupId>org.apache.maven</groupId>
        <artifactId>maven-core</artifactId>
        <version>3.2.5</version>
    </dependency>
    

    You can find this out by searching the Maven Central Repository, By Classname. Just put org.apache.maven.plugin.BuildPluginManager into the Classname input field.

    enter image description here