啟動maven的web項目
阿新 • • 發佈:2017-07-07
啟動 web項目 ati 打印 fig tar tid cat star
一、可以通過在pom中配置tomcat插件。
首先要確保你的倉庫裏有這個插件,然後按如下配置。
<build> <plugins> <!-- 配置Tomcat插件 --> <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <configuration> <path>/</path> <port>8081</port> </configuration> </plugin> </plugins> </build>
配置中的path是執行路徑,port是運行端口。這裏寫的是"/"和"8080",即代表訪問路徑為"localhost:8080"。
然後右鍵項目,maven build,輸入"clean tomcat7:run"
查詢打印日誌沒有報錯,並且出現"信息: Starting ProtocolHandler ["http-bio-8081"]"代表運行成功。可打開瀏覽器訪問頁面。
二、
啟動maven的web項目