1.在pom.xml如下配置
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.1</version>
<configuration>
<port>8080</port>
<server>tomcat7</server>
</configuration>
</plugin>
2.點擊Run 在彈出小框中選擇 Edit Configurations
3. 在Configurations窗口中的左上角 點擊 + 號 ,再選擇maven選項 ,然後就可以在右邊配置tomcat run的信息,需要配置的有:Name = 項目名 command line = tomcat7:run Working directory = 項目的路徑 , 配置完成後,點擊右下角的Apply,然後點擊OK完成
4. 配置完成後,在綠色三角形run的旁邊的下拉框裏就有剛剛配置的項目名稱了,上面配置的項目名稱是springMvc001,所以這裏是springMvc001,選擇springMvc001,然後點擊綠色三角形執行Run就可以了
5.項目成功啓動,通過http://localhost:8080/springMvc-001 就可以訪問項目了