MAVEN Learning---Deploying sites using MVN Site-deploy

Source: Internet
Author: User

Here is a guide to show you how to use "MVN Site:deploy" to automate the deployment of the generated document site to the server, described here through the WebDAV mechanism.

P.S in this article, we are using the Apache Server 2.x WebDAV feature.

1. Enable WebDAV

See this guide to learn how to enable WebDAV access to the Apache 2.x server.

2. Configure Where to deploy

In Pom.xml, configure the "distributionmanagement" tab to deploy your site.

<distributionManagement>    <site>      <id>yiibaiserver</id>      <url>dav:http ://127.0.0.1/sites/</url>    </site></distributionManagement>
Note
The "DAV" prefix is added before the HTTP protocol, which means that your site is deployed through the WebDAV mechanism. Alternatively, you can replace it with "SCP" If your server supports "SCP" access.

Tell Maven to use the "wagon-webdav-jackrabbit" extension deployment.

<build><extensions><extension><groupId>org.apache.maven.wagon</groupId>< artifactid>wagon-webdav-jackrabbit</artifactid><version>1.0-beta-7</version></ Extension></extensions></build>
Wagon-webdav
Some people say you can use "Wagon-webdav", but this is not what I tried to do, so here is a "wagon-webdav-jackrabbit" instead.
<extension>            <groupId>org.apache.maven.wagon</groupId>            <artifactid>wagon-webdav </artifactId>            <version>1.0-beta-2</version></extension>

Pom.xml the entire file content:

 <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.yiibai.core</groupId> <artifactId> yiibai-core</artifactid> <packaging>jar</packaging> <version>1</version> <name >yiibai-core</name> <url>http://maven.apache.org</url> <build><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>yiibaiserver</id> <url>dav:http://127 .0.0.1/sites/</url> </site> </distributionmanagement></project> 
3. Configure WebDAV Authentication

Typically, WebDAV is required for authenticated access. Therefore, the relevant authentication details (user name and password) need to be%maven_path%/conf/settings.xml.

File:settings.xml

<servers><server><id>yiibaiserver</id><username>admin</username>< Password>123456</password></server></servers>
What is "Yiibaiserver"?
The "settings.xml" File server ID in MAVEN will be referenced in the "Pom.xml" file by the Web site. 4. MVN Site:deploy

The "mvn site:deploy" command executes:

C:\WORKSP\YIIBAI-CORE&GT;MVN Site:deploy ... Transfer finished. 11622 bytes copied in 0.021 seconds November 03, 2015 9:00:07 pm Org.apache.commons.httpclient.auth.AuthChallengeProcessor Sele Ctauthscheme Info: Digest authentication scheme selecteduploading:.//project-info.html to http://127.0.0.1/sites/# #十一月 03, 2015 9:00:07 pm org.apache.commons.httpclient.auth.AuthChallengeProcessor selectauthscheme Info: Digest Authentication scheme selected# #http://127.0.0.1/sites//./project-info.html-status Code:201transfer finished. 11170 bytes copied in 0.035 seconds November 03, 2015 9:00:07 pm Org.apache.commons.httpclient.auth.AuthChallengeProcessor Sele Ctauthscheme Info: Digest authentication scheme selecteduploading:.//project-summary.html to http://127.0.0.1/sites/## November 03, 2015 9:00:07 pm org.apache.commons.httpclient.auth.AuthChallengeProcessor selectauthscheme Info: Digest Authentication scheme selected# #http://127.0.0.1/sites//./project-summary.html-status Code:201transfer finished. 10190 bytes CopiEd in 0.021 secondshttp://127.0.0.1/sites/-session:disconnectinghttp://127.0.0.1/sites/-Session:disconnected[info ]------------------------------------------------------------------------[INFO] BUILD Success[info]------------- -----------------------------------------------------------[INFO] Total time:28.737 s[info] finished at: 2015-11-03t21:00:07+08:00[info] Final Memory:14m/156m[info]----------------------------------------------------- -------------------

All site folders and files in the project folder-"Target/site" will be automatically deployed to the server.

5. Output

In this example, you can access the deployed site through this URL: http://127.0.0.1/sites/, see:

Complete.

Reference
    1. Http://maven.apache.org/plugins/maven-site-plugin/usage.html
    2. Http://mojo.codehaus.org/wagon-maven-plugin/usage.html
    3. Http://maven.apache.org/plugins/maven-site-plugin/deploy-mojo.html
    4. Http://maven.40175.n5.nabble.com/site-deploy-using-DAV-with-digest-auth-td125042.html
    5. Http://www.sonatype.com/books/maven-book/reference/site-generation-sect-deploy-site.html


Tags: mvn site deploy deployment sites WebDAV

This site is reproduced in addition to the article, are the original site or compiled
Welcome any form of reprint, but please be sure to indicate the source, respect for the work of others to create excellent examples of the tutorial
Reprint Please specify: Article reprinted from: http://www.yiibai.com/maven/deploy-site-with-mvn-site-deploy-webdav-example.html

MAVEN Learning---Deploying sites using MVN Site-deploy

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.