1,Maven 面板 html
Root ,至關於 VS 中的 sln ? ,大概能夠這樣理解吧。java
clean --> install 這樣操做, 全部的項目都會被執行。 web
手工操做有點麻煩。換另外一種方式 apache
在控制檯執行tomcat
mvn clean install -Dmaven.test.skip=true –X
與上面的命令類似的
mvn install -Dmaven.test.skip=true -Djar.forceCreation -X (試用後感受這條比clean 好些, clean 會刪除文件,若是正在熱部署,會產生文件鎖定的可能性沒法刪除,這條暫時還沒遇到)
eclipse
其它的命令還有
mvn clean compile、mvn clean test、mvn clean package、mvn clean install
2,啓動WEB容器
通常狀況下,推薦使用 集成容器, 爲何呢?在 VS開發中,如今誰不用IIS Express 去運行,調試代碼呢?
jetty和tomcat 均可以,通常 我用 jetty , 你們都說jetty快, 我也沒以爲,心理做用吧。不過, java web 容器的啓動真是無語。慢或者出錯就啓不來了
另外,我已經將 這兩個插件配置成爲熱部署, (也就是 容器檢測到內容的改變,會自動重啓加載)
下面是Pom中與之相應的配置節點
<build> <plugins> <!--tomcat7插件--> <!--https://tomcat.apache.org/maven-plugin-2.0/tomcat7-maven-plugin/run-mojo.html--> <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>${tomcat7-maven-plugin.version}</version> <configuration> <path>${tomcat-path.version}</path> <port>${tomcat-port.version}</port> <uriEncoding>${tomcat-uri-encoding.version}</uriEncoding> <url>http://localhost:8080/manager/text</url> <server>tomcat7</server> <username>admin</username> <password>admin</password> <contextReloadable>true</contextReloadable> <update>true</update> </configuration> </plugin> <!--jetty插件--> <!--http://www.eclipse.org/jetty/documentation/9.0.0.M3/jetty-maven-plugin.html--> <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <version>${jetty-plugin.version}</version> <configuration> <stopKey>foo</stopKey> <stopPort>8081</stopPort> <connectors> <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector"> <port>${jetty-port.version}</port> </connector> </connectors> <webApp> <contextPath>${jetty-path.version}</contextPath> </webApp> <!--scanIntervalSeconds 可選[秒]。在很短的時間間隔內在掃描web應用檢查是否有改變,若是發覺有任何改變則自動熱部署。默認爲0,表示禁用熱部署檢查。任何一個大於0的數字都將表示啓用。--> <scanIntervalSeconds>1</scanIntervalSeconds> </configuration> </plugin> </plugins></build>