使用mvn site:deploy命令后,无法使用WebDAV协议将项目文档发布到Apache

时间:2015-05-04 20:30:39

标签: java apache maven webdav

我正在尝试使用mvn site:deploy命令部署项目相关信息,但我收到了以下错误。

有人可以指导一下这里缺少的东西吗?

错误日志:

http://gsi-547576/sites/ - Session: Opened
[INFO] Pushing C:\nital\my-pet-projects\istore\istore-mvc2\istore-mvc2-domain\target\site
[INFO]    >>> to http://gsi-547576/sites/./
May 04, 2015 4:18:58 PM org.apache.commons.httpclient.auth.AuthChallengeProcessor selectAuthScheme
INFO: digest authentication scheme selected
May 04, 2015 4:18:58 PM org.apache.commons.httpclient.HttpMethodDirector processWWWAuthChallenge
INFO: No credentials available for DIGEST 'DAV-upload'@gsi-547576:80
May 04, 2015 4:18:58 PM org.apache.commons.httpclient.auth.AuthChallengeProcessor selectAuthScheme
INFO: digest authentication scheme selected
May 04, 2015 4:18:58 PM org.apache.commons.httpclient.HttpMethodDirector processWWWAuthChallenge
INFO: No credentials available for DIGEST 'DAV-upload'@gsi-547576:80
May 04, 2015 4:18:58 PM org.apache.commons.httpclient.auth.AuthChallengeProcessor selectAuthScheme
INFO: digest authentication scheme selected
May 04, 2015 4:18:58 PM org.apache.commons.httpclient.HttpMethodDirector processWWWAuthChallenge
INFO: No credentials available for DIGEST 'DAV-upload'@gsi-547576:80
 Transfer error: java.io.IOException: Unable to create collection: http://gsi-547576/sites/; status code = 401
Uploading: .//css/maven-base.css to http://gsi-547576/sites/

#May 04, 2015 4:18:58 PM org.apache.commons.httpclient.auth.AuthChallengeProcessor selectAuthScheme
INFO: digest authentication scheme selected
May 04, 2015 4:18:58 PM org.apache.commons.httpclient.HttpMethodDirector processWWWAuthChallenge
INFO: No credentials available for DIGEST 'DAV-upload'@gsi-547576:80
http://gsi-547576/sites//./css/maven-base.css - Status code: 401
 Transfer error: org.apache.maven.wagon.TransferFailedException: Failed to transfer file: http://gsi-547576/sites//./css/maven-base.css. Return code is: 401
http://gsi-547576/sites/ - Session: Disconnecting
http://gsi-547576/sites/ - Session: Disconnected
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.968 s
[INFO] Finished at: 2015-05-04T16:18:58-04:00
[INFO] Final Memory: 14M/219M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.4:deploy (default-cli) on project istore-mvc2-domain: Error uploading site: Failed to transfer fil
sites//./css/maven-base.css. Return code is: 401 -> [Help 1]

httpd.conf(支持WebDAV的模块)

LoadModule alias_module modules/mod_alias.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule dav_module modules/mod_dav.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule dav_lock_module modules/mod_dav_lock.so
LoadModule setenvif_module modules/mod_setenvif.so

# Distributed authoring and versioning (WebDAV)
Include conf/extra/httpd-dav.conf

我已经在我的WAMP服务器上启用了WebDAV协议,httpd-dav.conf看起来像这样:

的httpd-dav.conf

Alias /sites "C:/wamp/www/sites" 
<Directory "C:/wamp/www/sites">
    Dav On

    Order Allow,Deny
    Allow from all

    AuthType Digest
    AuthName DAV-upload

    Options Indexes

    AuthUserFile "C:/wamp/bin/apache/apache2.4.9/user.passwd"
    AuthDigestProvider file

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

生成user.passwd文件并将其放在文件夹C:/wamp/bin/apache/apache2.4.9/文件夹中。

的pom.xml

  ....
  <!-- Uploading project documentation/information -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-site-plugin</artifactId>
            <version>3.4</version>
            <dependencies>
                <dependency><!-- add support for ssh/scp -->
                    <groupId>org.apache.maven.wagon</groupId>
                    <artifactId>wagon-ssh</artifactId>
                    <version>1.0</version>
                </dependency>
            </dependencies>
        </plugin>
   </plugins>
    <!-- Uploading project documentation/information -->
    <extensions>
        <extension>
            <groupId>org.apache.maven.wagon</groupId>
            <artifactId>wagon-webdav-jackrabbit</artifactId>
            <version>1.0-beta-7</version>
        </extension>
    </extensions>
</build>
<distributionManagement>
    <site>
        <id>my-wamp-server</id>
        <url>dav:http://gsi-547576/sites/</url>
    </site>
</distributionManagement>

的settings.xml

<servers>
    <server>
        <id>my-wamp-server</id>
        <username>admin</username>
        <password>admin123<password>
    </server>
</servers>

1 个答案:

答案 0 :(得分:0)

Maven无法找到您的凭据。

  

信息:没有可用于DIGEST'DAV-upload'的凭据@ gsi-547576:80

根据Maven documentation您的settings.xml缺少设置标记。

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                      https://maven.apache.org/xsd/settings-1.0.0.xsd">
  <servers>
    <server>
      <id>my-wamp-server</id>
      <username>admin</username>
      <password>admin123</password>
    </server>
  </servers>
</settings>