SSM到SpringBoot(校园商铺)1

SSM到SpringBoot(校园商铺)

环境准备:

1、配置Maven3.3.9、tomcat8、jdk8

2、创建maven项目maven-project → maven-archetype-webapp → artifact id:o2o

3、 此时提示报错:
SSM到SpringBoot(校园商铺)1

原始是缺少tomcat下的一个jar包 ,将它引入:

右键项目名→properties→Java build path→libraries→add library→server runtime→Apache tomcat v8.0

4、此时提示warnings:
SSM到SpringBoot(校园商铺)1

修改pom.xml:

  <build>
    <finalName>o2o</finalName>
    <plugins>
    	<plugin>
    		<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-compiler-plugin -->
		    <groupId>org.apache.maven.plugins</groupId>
		    <artifactId>maven-compiler-plugin</artifactId>
		    <version>3.7.0</version>
		    <configuration>
		    	<source>1.8</source>
		    	<target>1.8</target>
		    </configuration>
    	</plugin>
    </plugins>
  </build>

5、右键项目名→maven→update maven project =ok!

6、将缺少的src/test/resources添加上

7、此时项目的Dynamic web module版本是2.3。
SSM到SpringBoot(校园商铺)1

我们需要将其修改为3.1.但是由于eclipse的bug不能直接修改。我们通过修改项目的配置文件来修改。

SSM到SpringBoot(校园商铺)1
SSM到SpringBoot(校园商铺)1

修改后回到eclipse并刷新项目。

8、修改web.xml约束

<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
	version="3.1" metadata-complete="true">
	
	<display-name>Archetype Created Web Application</display-name>
	
	<welcome-file-list>
		<welcome-file>index.jsp</welcome-file>
		<welcome-file>index.html</welcome-file>
	</welcome-file-list>
	
</web-app>

9、将项目部署到tomcat并访问
SSM到SpringBoot(校园商铺)1