maven-2 - Maven : Could not transfer artifact Error code 401, 需要授权

标签 maven-2

我使用 maven 2.2.1 和 Eclipse Helios 作为 IDE 当我从命令提示符运行 mvn deploy 时,部署成功 但是当我使用 Eclipse Maven 插件并尝试从那里部署时

我得到以下异常

[INFO] Total time: 1.148s
[INFO] Finished at: Mon Oct 03 21:22:57 IST 2011
[INFO] Final Memory: 10M/104M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy (default-deploy) on project bayer: Failed to deploy artifacts: Could not transfer artifact com.tata:bayer:pom:1.0 from/to Test (dav:http://127.0.0.1/sites/): Access denied to http://127.0.0.1/sites/com/tata/bayer/1.0/bayer-1.0.pom. Error code 401, Authorization Required -> [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.

在我的 POM.xml 文件中,我有这个

<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-webdav-jackrabbit</artifactId>
<version>1.0-beta-7</version>
</extension>
</extensions>

<distributionManagement>
    <repository>
   <id>Test</id>
  <name>Parent Project</name>
 <url>dav:http://127.0.0.1/sites/</url>
  </repository>
</distributionManagement>


and in M2_HOME Settings.xml file i have these 

 <servers>
    <server>
        <id>Test</id>
        <username>admin</username>
        <password>Testing</password>
<filePermissions>664</filePermissions>
<directoryPermissions>775</directoryPermissions>
    </server>
    </servers>

终于在 Apache 网络服务器中,我将其用于存储库目的,我有这些

Alias /sites "/httpd-2.2-x64/sites"
<Directory "/httpd-2.2-x64/sites">
    Dav On

    Order Allow,Deny
    Allow from all
AllowOverride All
    AuthType Digest
    AuthName DAV-upload

    # You can use the htdigest program to create the password database:
    #   htdigest -c "/httpd-2.2-x64/user.passwd" DAV-upload admin
    AuthUserFile "/httpd-2.2-x64/user.passwd"
    AuthDigestProvider file

    # Allow universal read-access, but writes are restricted
    # to the admin user.
    <LimitExcept GET OPTIONS>
        require user admin
    </LimitExcept>
</Directory>

谁能告诉我为什么我会得到这个

错误代码 401,需要授权 -> [帮助 1]

(再次在 comamnd 提示下工作正常,但不是来自 Eclipse IDE Maven 插件)

非常感谢

最佳答案

检查您的 .settings.xml 文件,您必须在连接到远程存储库时设置用户名/密码....在海报的情况下,我认为这是错误的用户名/密码..

关于maven-2 - Maven : Could not transfer artifact Error code 401, 需要授权,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7637643/

相关文章:

eclipse - 使用 Eclipse 和 Tomcat 开发 Scala/Lift Web 应用程序

java - 如何使用 emma 计算 Hudson 中多模块 Maven 项目的代码覆盖率,但只运行一次测试

maven-2 - maven-jar-plugin addClasspath 范围

maven-2 - 使用 Maven jar 打包目标/类以外的内容

java - 如何仅跳过针对 "compile"和 "install"目标而不是 "test"目标的测试?

maven-2 - Maven - 制作可以独立于父项目的子项目

java - Sonatype Nexus : How to use my Seagate personal cloud storage device as a repository for my maven artifacts?

java - 如何将 Maven 管理的依赖项复制到 war\web-inf\lib 中,以便我可以在 Eclipse 中以 Debug模式运行我的 GWT 2.0 应用程序?

maven-2 - 如何在不编写任何 pom.xml 的情况下从 Maven Central 下载 jars

maven-2 - Maven 发布 :perform without deploy and calling an external shell script