Maven使用site-deploy(site:deploy)部署經過site生成的文檔(Tomcat-WebDAV)

Maven能夠經過site生成項目的幫助文檔,而且格式爲html,那麼能夠經過site-deploy把文檔部署到遠端,部署方式支持HTTP/FTP/SCM/WebDAV等。html

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

下面將展現使用Tomcat的WebDAV功能實現文檔的部署,實現以前須要確保Tomcat已經開啓此功能(開啓教程:http://www.cnblogs.com/EasonJim/p/6859345.html):git

一、配置POMgithub

<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%\conf\settings.xml的<server>節點對應,<url>爲配置好webdav的目錄,而且前面帶上dav:前綴,表示是以WebDAV協議進行訪問。web

二、配置%M2_HOME%\conf\settings.xml,增長<server>節點,內容以下:apache

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

三、部署tomcat

mvn site:deploy

完成後打開站點http://127.0.0.1:8080/webdav測試:app

成功部署。maven

 

測試工程:https://github.com/easonjim/5_java_example/tree/master/maventest/test7/testprojectide

相關文章
相關標籤/搜索