`

maven deploy到nexus报错:Return code is: 401, ReasonPhrase:Unauthorized

 
阅读更多
eclipse中使用clean deploy 命令,将本地文件推送到nexus时候报错:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project *: Failed to deploy artifacts: Could not transfer artifact *:jar:1.0 from/to releases (http://10.1.81.199:8081/nexus/content/repositories/releases/): Failed to transfer file: http://10.1.81.199:8081/nexus/content/repositories/releases/com/cs2c/security-management-client* /1.0/*-1.0.jar. Return code is: 401, ReasonPhrase:Unauthorized.

原来是没有配置认证。


maven目录conf的setting.xml里,

引用
<servers>
<server> 
    <id>releases</id> 
    <username>admin</username> 
    <password>admin123</password> 
  </server> 
<server> 
  <id>snapshots</id> 
  <username>admin</username> 
  <password>admin123</password> 
  </server> 
</servers> 


用户名和密码都是nexus的。再次deploy即可。

注意这里的id要和pom.xml里远程deploy的地址对应一致,我的pom.xml里配置:

<!-- 配置远程发布到私服,mvn deploy -->  
    <distributionManagement>  
        <repository>  
            <id>releases</id>  
            <name>Nexus Release Repository</name>  
            <url>http://10.1.81.199:8081/nexus/content/repositories/releases/</url>  
        </repository>  
        <snapshotRepository>  
            <id>snapshots</id>  
            <name>Nexus Snapshot Repository</name>  
            <url>http://10.1.81.199:8081/nexus/content/repositories/snapshots/</url>  
        </snapshotRepository>  
    </distributionManagement>  


如果这里不配置,会报错:
报错:Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy (default-deploy) on project Git-demo: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter

参考:http://blog.csdn.net/happyteafriends/article/details/8174110
分享到:
评论

相关推荐

    关于maven打包时的报错: Return code is: 501 , ReasonPhrase:HTTPS Required

    主要介绍了关于maven打包时的报错: Return code is: 501 , ReasonPhrase:HTTPS Required,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧

    maven-deploy-plugin-2.8.2.jar

    maven-deploy-plugin-2.8.2.jar

    maven中 引入jar报错:Missing artifact net.sf.json-lib:json-lib:jar:2.4

    &lt;groupId&gt;net.sf.json-lib&lt;/groupId&gt; &lt;artifactId&gt;json-lib &lt;version&gt;2.4 &lt;classifier&gt;jdk15 或者直接下载这个包

    Maven报错: Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.0.2:resources

    idea创建Maven项目时,报错显示Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.0.2:resources,并且Maven插件内看不到 mybatis-generator。如下图: 折腾了好久发现配置放错地方了,...

    Maven deploy到 nexus(csdn)————程序.pdf

    ### Maven部署到Nexus知识点详解 #### Maven与Nexus简介 - **Maven**:Apache Maven是一款基于项目对象模型(POM)的软件项目管理和理解工具。通过一系列标准生命周期构建项目,简化了项目的构建、依赖管理和文档...

    maven-deploy-plugin-2.7.jar

    maven-deploy-plugin-2.7.jar

    Jenkins编译报错Failed to execute goal org.apache.maven.plugins_maven-clean-plugin

    Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean) on project

    maven3.8.3+nexus3.34.zip

    标题"Maven3.8.3+nexus3.34.zip"和描述中提及的是一个包含Maven 3.8.3版本和Nexus 3.34版本的压缩包文件,适用于Windows 64位操作系统。这两个工具在软件开发,尤其是Java开发中扮演着重要角色。以下是关于Maven和...

    Maven deploy配置方法详解

    Maven deploy 是 Maven 生命周期的一部分,负责将项目的构件部署到远程仓库中,以便其他开发者和工程共享。下面将详细介绍 Maven deploy 配置方法。 pom.xml 配置 在 pom.xml 文件中,需要在 project 标签下添加 ...

    maven更新本地私服报错

    maven本地仓库的更新 连网后window+R 输入cmd回车 输入maven 版本查看 mvn -v 更新本地仓库命令 mvn help:system 回车如图是成功: 失败报错如下: Failed to execute goal org.apache.maven.plugins:maven-...

    windows下eclipse跑junit报错:CreateProcess error=206

    windows下eclipse跑junit报错:CreateProcess error=206后面跟着乱码。 把这个jar替换掉就好了,放在:eclipse/plugins/下面。 参考:https://bugs.eclipse.org/bugs/show_bug.cgi?id=327193

    Drools报错:The Eclipse JDT Core jar is not in the classpath

    标题 "Drools报错: The Eclipse JDT Core jar is not in the classpath" 提示了一个常见的编程问题,即在使用Drools规则引擎时,由于缺少Eclipse JDT(Java Development Tools)核心库,导致运行错误。这个问题涉及...

    nexus 搭建 maven仓库

    nexus 搭建 maven仓库nexus 搭建 maven仓库nexus 搭建 maven仓库nexus 搭建 maven仓库nexus 搭建 maven仓库

    最新maven私服工具nexus.zip

    2. **部署工件**:通过Maven的deploy插件,可以将项目构建的jar、pom等文件上传到Nexus的发布仓库。 3. **依赖管理**:在POM文件中,指定依赖的版本和仓库,Maven会自动从Nexus获取。 ### 五、最佳实践 1. **定期...

    maven私服(nexus)配置(setting,pom.xml)

    4. 使用`mvn deploy`命令将项目发布到Nexus。 5. 项目中引用依赖时,Maven会自动从Nexus下载。 通过以上配置,你可以成功地将Nexus设置为Maven的本地中央仓库,实现依赖的高效管理和发布。这个过程有助于优化项目...

    在项目中通过maven私服来使用jar包

    "Maven 私服使用 Jar 包详解" 在项目中通过 Maven 私服来使用 Jar 包是一个常见的实践,通过配置 Maven 设置和项目 pom.xml 文件,可以轻松地使用公司内部提供的基础包、工具包等。下面我们将详细介绍如何配置 ...

    maven-deploy-plugin:Apache Maven Deploy插件

    这样,您可以确保您不会浪费时间在不属于Apache Maven范围的事情上。 假设您的问题不存在,请提交该问题的票证。 清楚地描述问题,包括在出现错误时重现的步骤。 确保填写已知问题的最早版本。 在GitHub上分叉存储...

    配置maven私服nexus

    Nexus是一个强大的Maven仓库管理器,它极大地简化了自己内部仓库的维护和外部仓库的访问。利用Nexus,你可以只在一个地方就能完全控制访问和部署在你所维护仓库中的每个Artifact。Nexus是一套“开箱即用”的系统不...

    maven-deploy-plugin-2.5.jar

    maven-deploy-plugin-2.5.jar

Global site tag (gtag.js) - Google Analytics