标签:地方 war 分享 const release tps 检查 pil mon
一,先确定已经安装好了Eclipse Java EE IDE for Web Developers我用的是如下版本
Version: Neon.3 Release (4.6.3)
Build id: 20170314-1500
然后新增一个Maven project如下图,勾选上前2个复选框
二,填写groupid和artifactid等,最关键的是要选war类型的packaging,如下图:
三,然后修改如下3个地方的jdk配置为1.8并且把Project Facets中的Dynamic web module选为3.1
四、修改pom.xml内容如下:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.xhl</groupId>
<artifactId>eduhomeweb</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>xhleduhomewebportal</name>
<description>xhl edu related home web portal</description>
<build>
<plugins>
<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>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<srping.version>4.3.6.RELEASE</srping.version>
<mybatis.version>3.4.3</mybatis.version>
<mybatis-spring.version>1.3.1</mybatis-spring.version>
<mysql.version>5.1.41</mysql.version>
<log4j2.version>2.8.2</log4j2.version>
<taglibs.version>1.2.5</taglibs.version>
<dbcp2.version>2.1.1</dbcp2.version>
</properties>
<!--spring related start -->
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${srping.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>${srping.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${srping.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${srping.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${srping.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${srping.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>${srping.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-instrument</artifactId>
<version>${srping.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-instrument-tomcat</artifactId>
<version>${srping.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${srping.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jms</artifactId>
<version>${srping.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${srping.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>${srping.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${srping.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${srping.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${srping.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${srping.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc-portlet</artifactId>
<version>${srping.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-websocket</artifactId>
<version>${srping.version}</version>
</dependency>
<!--spring related end -->
<!--mybatis related start -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>${mybatis.version}</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>${mybatis-spring.version}</version>
</dependency>
<!-- mybatis related end -->
<!-- mysql related start -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
</dependency>
<!-- mysql related end -->
<!-- log4j2 related start -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4j2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j2.version}</version>
</dependency>
<!-- log4j2 related end -->
<!-- taglibs related start -->
<dependency>
<groupId>org.apache.taglibs</groupId>
<artifactId>taglibs-standard-spec</artifactId>
<version>${taglibs.version}</version>
</dependency>
<dependency>
<groupId>org.apache.taglibs</groupId>
<artifactId>taglibs-standard-impl</artifactId>
<version>${taglibs.version}</version>
</dependency>
<!-- taglibs related end -->
<!-- dbcp2 related start -->
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-dbcp2 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-dbcp2</artifactId>
<version>${dbcp2.version}</version>
</dependency>
<!-- dbcp2 related end -->
</dependencies>
</project>
然后执行Maven选项中的Update project,执行完后再检查下上面提到的3个jdk配置是否变化
五、然后新增一个eclipse的dynamic web project然后把WEB-INF/web.xml和META-INF目录下的文件拷贝到Maven工程的webapp目录下,如下图:
六、然后检查一下如下图的Deployment Assembly是不是正确
七、然后把dto、dao、service、controller等加入项目就可以通过发布到tomcatv8.5进行页面访问了,但是需要注意由于没有把tomcat的相关jar包包含进来,所以开发jsp和servlet的时候会报错,所以需要把如下图的tomcat相关lib加入build path
遇到问题:
eclipse搭建maven project的spring4 spring mvc mybatis
标签:地方 war 分享 const release tps 检查 pil mon
原文地址:http://www.cnblogs.com/xiaohanlin/p/6917221.html