Maven:无法传输工件错误代码401,需要授权

时间:2011-10-03 16:13:05

标签: 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,需要授权 - &gt; [帮助1]

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

非常感谢

1 个答案:

答案 0 :(得分:0)

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