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工作时,依赖库和插件库互不关联,即增加配置存储库的时候,不要忘记增加插件库

附官方文档:
http://maven.apache.org/pom.html#Plugin_Repositories

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。