Maven Dependency jar for BuildPluginManager

笑着哭i 提交于 2019-12-11 04:18:06

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/41493372/maven-dependency-jar-for-buildpluginmanager

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!