首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >未能在项目上执行目标org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy默认部署

未能在项目上执行目标org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy默认部署
EN

Stack Overflow用户
提问于 2016-05-09 22:41:14
回答 2查看 75.7K关注 0票数 13

错误未能在项目上执行目标org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (默认部署)。未能部署工件:无法传输artifactReturn代码是: 401,ReasonPhrase:未经授权。->帮助1

自上一次成功构建以来,没有进行任何更改。我再次检查settings.xml(用户名和密码).Also签入pom.xml(分发管理)

我从过去的两天开始研究这个问题,我浏览了所有的论坛,没有任何works.please帮助我。

EN

回答 2

Stack Overflow用户

发布于 2018-02-02 17:13:43

此错误消息意味着您的计算机没有对Nexus计算机进行正确的身份验证。从Maven发送给Nexus的凭据是不正确的。

当我收到这条消息时,我通常需要查看我的settings.xml来验证这个部分的正确凭证。用户名和密码必须是正确的设置在Nexus本身。

代码语言:javascript
复制
<servers>
    <server>
        <id>nexus-releases</id>
        <username>fillin</username>
        <password>fillin</password>
    </server>
</servers>

我通常使用Nexus并尝试使用这些凭据登录来验证它们,但是可以配置凭据,这些凭据可以通过mvn发布,但不能登录到GUI中。

一个可能的问题是,如果您使用依赖关系管理来确定在"mvn部署“目标情况下部署到哪里。有这样的一节:

代码语言:javascript
复制
<distributionManagement>
    <repository>
        <id>nexus-releases</id>
        <name>releases</name>
        <url>http://myNexus/more/stuff</url>
    </repository>
</distributionManagement>

并且id字段必须与settings.xml中凭据上的id匹配。如果ids不匹配,您将得到此错误。

另一个可能的问题是,如果在pom.xml中使用maven-deply-plugin的执行,则可能具有配置属性。

代码语言:javascript
复制
<repositoryId>nexus-releases</repositoryId> 

同样,它与settings.xml中的id不匹配,因此它会因错误而失败。

类似地,如果在"mvn“命令上使用命令行选项进行部署,则如下所示

代码语言:javascript
复制
-DrepositoryId=nexus-releases

与settings.xml中的id不匹配,同样,它将无法工作。

票数 6
EN

Stack Overflow用户

发布于 2016-05-17 07:54:19

在注释部分讨论之后,尝试运行此pom.xml

当mvn的目标应该是:mvn部署

唯一需要的两件事是拥有一个pom并传递参数:

这是您可以使用的pom.xml:

代码语言:javascript
复制
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.hp.Maven</groupId>
    <artifactId>Maven-Nexus</artifactId>
    <packaging>pom</packaging>
    <version>1.0.0</version>

    <properties>
        <baseNexusURL>${baseNexusURL}</baseNexusURL>
        <targetRepositoryID>${repositoryId}</targetRepositoryID>
        <package.final.name>${project.artifactId}</package.final.name>
    </properties>

        <build> 
        <plugins>
            <plugin>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>2.8.2</version>
                <executions>
                    <execution>
                        <id>default-deploy</id>
                        <configuration>
                            <skip>true</skip>
                        </configuration>
                    </execution>
                    <execution>
                        <id>deploy-node-modules-artifact</id>
                        <phase>deploy</phase>
                        <goals>
                            <goal>deploy-file</goal>
                        </goals>
                        <configuration>
                            <file>${file}</file>
                            <groupId>${groupId}</groupId>
                            <artifactId>${artifactId}</artifactId>
                            <version>${version}</version>
                            <packaging>${packaging}</packaging>
                            <generatePom>true</generatePom>
                            <repositoryId>${targetRepositoryID}</repositoryId>
                            <url>${baseNexusURL}/content/repositories/${targetRepositoryID}</url>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37126573

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档