【maven】Deployment failed: repository element was not specified in the POM inside distributionManagem

需要把本地代码进行使用maven的上传命令时遇到的报错
原因:是deploy插件的版本是2.7,需要在项目的pom.xml文件中配置上传的仓库信息,升级到2.8后会使用setting.xml中的配置。
在这里插入图片描述

    <build>
        <!-- 在pom.xml文件中的 build->plugins标签下添加 -->
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>2.8.2</version>
            </plugin>
        </plugins>
    </build>

    <!-- 上传制品 打开项目的pom.xml文件,设置上传的仓库名称为本地制品仓库名称,通过mvn deploy操作即可将项目编译构建的制品上传到项目本地制品仓库。-->
    <distributionManagement>
        <repository>
            <id>central</id>
            <name>artifactory-releases</name>
            <url>https://you-url-release-maven-local</url>
        </repository>
        <snapshotRepository>
            <id>snapshots</id>
            <name>artifactory-snapshots</name>
            <url>>https://you-url-snapshot-maven-local</url>
        </snapshotRepository>
    </distributionManagement>

猜你喜欢

转载自blog.csdn.net/u010638673/article/details/132902426