zoukankan      html  css  js  c++  java
  • Maven使用site-deploy(site:deploy)部署通过site生成的文档(Tomcat-WebDAV)

    Maven可以通过site生成项目的帮助文档,并且格式为html,那么可以通过site-deploy把文档部署到远端,部署方式支持HTTP/FTP/SCM/WebDAV等。

    更多部署方案,参考:https://maven.apache.org/wagon/wagon-providers/index.html

    下面将展示使用Tomcat的WebDAV功能实现文档的部署,实现之前需要确保Tomcat已经开启此功能(开启教程:http://www.cnblogs.com/EasonJim/p/6859345.html):

    1、配置POM

    <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.jsoft.test</groupId>
      <artifactId>testproject</artifactId>
      <packaging>war</packaging>
      <version>0.1-SNAPSHOT</version>
      <name>testproject Maven Webapp</name>
      <url>http://maven.apache.org</url>
      <distributionManagement>
        <site>
          <id>tomcatserver</id>
          <url>dav:http://127.0.0.1:8080/webdav/</url>
        </site>
      </distributionManagement>
      <dependencies>
        <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>3.8.1</version>
          <scope>test</scope>
        </dependency>
      </dependencies>
      <build>
        <finalName>testproject</finalName>
        <extensions>
            <extension>
                <groupId>org.apache.maven.wagon</groupId>
                <artifactId>wagon-webdav-jackrabbit</artifactId>
                <version>1.0-beta-7</version>
            </extension>
        </extensions>
      </build>
    </project>

    提示:WebDAV部署插件为wagon-webdav-jackrabbit,实质上为扩展。配置<distributionManagement>节点,增加<id>和<url>节点,其中<id>节点上的名称需要与%M2_HOME%confsettings.xml的<server>节点对应,<url>为配置好webdav的目录,并且前面带上dav:前缀,表示是以WebDAV协议进行访问。

    2、配置%M2_HOME%confsettings.xml,增加<server>节点,内容如下:

      <servers>
            ...
        <server>
            <id>tomcatserver</id>
            <username>root</username>
            <password>root</password>
        </server>
            ...
      </servers>

    3、部署

    mvn site:deploy

    完成后打开站点http://127.0.0.1:8080/webdav测试:

    成功部署。

    测试工程:https://github.com/easonjim/5_java_example/tree/master/maventest/test7/testproject

  • 相关阅读:
    从零开始入门 K8s | 应用编排与管理
    209. Minimum Size Subarray Sum
    208. Implement Trie (Prefix Tree)
    207. Course Schedule
    203. Remove Linked List Elements
    183. Customers Who Never Order
    182. Duplicate Emails
    181. Employees Earning More Than Their Managers
    1261. Find Elements in a Contaminated Binary Tree
    1260. Shift 2D Grid
  • 原文地址:https://www.cnblogs.com/EasonJim/p/6859355.html
Copyright © 2011-2022 走看看