zl程序教程

您现在的位置是:首页 >  后端

当前栏目

【异常】Maven提示 repository element was not specified in the POM inside distributionManagement element

Maven异常 in The not 提示 specified Element
2023-09-14 09:04:55 时间

一、报错内容

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project logan-web: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

二、报错说明

想要执行npm 的deploy操作,但是失败了。
在这里插入图片描述
想在本地的pom文件配置好之后,执行deploy命令,可以将maven所打的jar包上传到远程的repository,便于其他开发者和工程共享。但是本地都没有distributionManagement,如何怎么上传到Nexus私服呢?

三、解决方案

在项目下的pom文件里面新建,上传jar包到Nexus私服中,才能执行deploy动作。
在这里插入图片描述

<distributionManagement>
    <repository>
        <id>随便起</id>
        <url>maven环境下setting文件里面的私有库</url>
    </repository>
    <snapshotRepository>
        <id>随便起</id>
        <url>maven环境下setting文件里面的快照库</url>
    </snapshotRepository>
</distributionManagement>

把这个配置放到 POM文件下,然后重新depoly,就会出现BUILD成功了