怎样在IDEA中使用MAVEN搭建Spring Web MVC的Hello示例

来源:互联网 发布:光年无限科技公司知乎 编辑:程序博客网 时间:2024/04/30 08:59

怎样在IDEA中使用MAVEN搭建Spring Web MVC的Hello示例

  1. 目录结构

    • pom.xml
    • .gitignore
    • src
      • main
        • java
        • resource
        • webapp
          • index.jsp
          • WEB-INF
            • views
            • spring-servlet.xml
            • web.xml
      • test
  2. pom.xml
    <modelVersion>4.0.0</modelVersion>
    <groupId>HelloMVCTest</groupId>
    <artifactId>HelloMVCTest</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>war</packaging>

    <properties>
    <spring.version>3.2.13.RELEASE</spring.version>
    </properties>

    <dependencies>

    <dependency>    <groupId>org.springframework</groupId>    <artifactId>spring-webmvc</artifactId>    <version>${spring.version}</version></dependency><dependency>    <groupId>javax.servlet</groupId>    <artifactId>jstl</artifactId>    <version>1.2</version>    <scope>runtime</scope></dependency>

    </dependencies>

    <build>
    <finalName>spring-jpa-tomcat</finalName>
    <plugins>
    <plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <version>2.0</version>
    <configuration>
    <port>9090</port>
    <!-- application path always starts with /-->
    <path>/</path>
    <useTestClasspath>false</useTestClasspath>
    </configuration>
    </plugin>
    </plugins>
    </build>

0 0
原创粉丝点击