乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      maven集成tomcat進(jìn)行web應(yīng)用測試

       KILLKISS 2012-10-10
      1、環(huán)境介紹
      maven:apache-maven-3.0.3
      tomcat:apache-tomcat-6.0.32
      jdk:jdk1.5.0_11
      eclipse:3.7.2

      2、配置tomcat-maven-plugin
      在pom.xml中加入如下配置
      Xml代碼  收藏代碼
      1. <plugin>  
      2.     <groupId>org.codehaus.mojo</groupId>  
      3.     <artifactId>tomcat-maven-plugin</artifactId>  
      4.     <version>1.1</version>  
      5.     <configuration>  
      6.         <server>tomcat-6.0.32</server>  
      7.         <url>http://127.0.0.1:8080/manager</url>  
      8.         <uriEncoding>${encoding}</uriEncoding>  
      9.         <warSourceDirectory>WebContent</warSourceDirectory>  
      10.     </configuration>  
      11. </plugin>  


      說明:
      • tomcat-maven-plugin現(xiàn)在已拆分成tomcat7-maven-plugin和tomcat6-maven-plugin了,而groupId也由org.codehaus.mojo改為org.apache.tomcat.maven。
      • 詳情可參考:http://tomcat./maven-plugin-2/index.html


      3、集成tomcat測試的方法
      方法一(推薦):
      運行mvn tomcat:run命令,啟動內(nèi)嵌的tomcat進(jìn)行測試
      1) 可在命令行直接運行mvn tomcat:run命令
      2) 如果使用eclipse,可通過maven的eclipse插件m2e新增一個maven build運行tomcat:run命令,如圖:




      方法二:
      運行mvn tomcat:redeploy命令,將web應(yīng)用發(fā)布到外部已啟動的tomcat進(jìn)行測試
      1) 在maven的文件里加入如下設(shè)置:
      Xml代碼  收藏代碼
      1. <server>  
      2.     <id>tomcat-6.0.32</id>  
      3.     <username>tomcat</username>  
      4.     <password>tomcat</password>  
      5. </server>  

      2) 在tomcat/conf的tomcat-users.xml加入如下配置:
      Xml代碼  收藏代碼
      1. <role rolename="manager-gui"/>  
      2.   
      3. <role rolename="manager-script"/>  
      4.   
      5. <user username="tomcat" password="tomcat" roles="manager-gui, manager-script"/>  

      3) 啟動tomcat
      4) 類似方法一那樣執(zhí)行tomcat:redeploy命令

      方法三(不推薦):
      增加eclipse web工程支持,利用傳統(tǒng)的eclipse集成tomcat測試的方法進(jìn)行測試。此方法其實跟maven和tomcat-maven-plugin無關(guān),發(fā)布到tomcat下測試的war包不一定跟maven構(gòu)建的包一致,因此不推薦。
      1) 在工程屬性里的Project Facets里勾上Dynamic Web Module,如下圖:



      2) 在Deployment Assembly增加將maven依賴發(fā)布到“WEB-INF/lib”下,并將“/src/test/java”和“/src/test/resources”兩項刪除(因為maven打包時是不會打包這兩部分內(nèi)容的)



      3) 這樣便可以利用傳統(tǒng)的eclipse集成tomcat測試的方法進(jìn)行測試了,如下圖:



      補充:
      如果是多模塊工程,只需在父工程下運行tomcat-maven-plugin的goal即可。如:D:\<父工程目錄>>tomcat:run。tomcat-maven-plugin會自動檢測和替換相關(guān)的依賴。
      Text代碼  收藏代碼
      1. NOTE If you have a multi module Maven projects and use Maven3, you don't need to install all modules before use the run goal, just use tomcat6/7:run from the root module and the plugin will auto detect build output directory from various modules and replace dependencies with those directories in the webapp classloader.  


      更多關(guān)于tomcat-maven-plugin的使用,請參考:
      http://mojo./tomcat-maven-plugin/index.html
      http://tomcat./maven-plugin-2/index.html

        本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約