maven找不到插件,插件库问题
开发maven插件时遇到此问题
Cannot resolve plugin org.xx.xxx:xxxx-maven-plugin:1.0.0-RELEASE
IDEA报错
现象
自己开发的插件,deploy之后,同事在使用使拉取不到
但是只是在build-plugins-plugin
标签中拉取不到,放到dependencys
中可正常拉取
原因
公司自己搭建的nexus制品库,发布时发布到了私有制品库,但是maven默认是到中央插件仓库plugin repositories
中寻找的,因此会找不到插件,这也验证了上述情景
解决方案
在项目pom.xml
或者maven的setting.xml
中添加私有制品库即可
<pluginRepositories>
<pluginRepository>
<id>alimaven</id>
<url>https://maven.aliyun.com/repository/public</url>
</pluginRepository>
</pluginRepositories>
延伸
Repositories are home to two major types of artifacts. The first are artifacts that are used as dependencies of other artifacts. These are the majority of artifacts that reside within central. The other type of artifact is plugins. Maven plugins are themselves a special type of artifact. Because of this, plugin repositories may be separated from other repositories (although, I have yet to hear a convincing argument for doing so). In any case, the structure of the pluginRepositories element block is similar to the repositories element. The pluginRepository elements each specify a remote location of where Maven can find new plugins.
maven工作时,依赖库和插件库互不关联,即增加配置存储库的时候,不要忘记增加插件库