1. 程式人生 > 實用技巧 >Spring Tool Suite4(STS)建立Maven專案

Spring Tool Suite4(STS)建立Maven專案

1.下載安裝:

Maven

Spring Tool Suite(https://spring.io/tools)

2.建立Maven Project

3.配置pom.xml

<project>

  <build>標籤內新增tomcat外掛

<plugins>
    <plugin>
        <groupId>org.apache.tomcat.maven</groupId>
        <artifactId>tomcat7-maven-plugin</artifactId>
        <
version>2.2</version> <configuration> <port>8080</port><!----> <path>/mymaven</path><!-- 專案根路徑 --> <uriEncoding>UTF-8</uriEncoding> </configuration> </plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <configuration> <source>1.8</source> <target>1.8</target> <
encoding>utf-8</encoding> </configuration> </plugin> </plugins>

5.執行專案:

Run As -->Maven Build...

在Goals輸入tomcat7:run