maven自動發佈到服務器

####使用Maven插件自動自動發佈到遠程Tomcat容器html

vi ${tomcat_home}/conf/tomcat-users.xml

####tomcat-users標籤下加入以下代碼web

<user username="tomcat" password="tomcat" roles="manager-gui,manager-script,manager-jmx,manager-status,admin-gui,admin-script"/>

####項目pom文件中加入以下內容apache

<plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.3.2</version>
        <configuration>
            <source>1.7</source>
            <target>1.7</target>
        </configuration>
    </plugin>
    <plugin>  
        <groupId>org.apache.tomcat.maven</groupId>  
        <artifactId>tomcat7-maven-plugin</artifactId>  
        <version>2.2</version>  
        <configuration>  
            <url>http://192.168.3.106:8580/manager/text</url>  
            <username>tomcat</username>  
            <password>tomcat</password> 
            <!-- 部署到webapps目錄下,文件名爲schedue.war --> 
            <path>/schedue</path>  
        </configuration>
    </plugin> 
</plugins>
#發佈命令
mvn tomcat7:deploy #部署
mvn tomcat7:redeploy #從新部署
mvn tomcat7:undeploy #撤銷部署
mvn tomcat7:start/stop #啓動/中止tomcat插件

####注意<configuration>-<url> ####tomcat7是http://192.168.3.106:8580/manager/text ####tomcat6是http://localhost:8080/manager/html ####本配置僅適用tomcat7的maven插件tomcat

相關文章
相關標籤/搜索