O2O校园商铺平台开发——v0.0.1环境搭建

版权声明:作者已开启版权声明,如转载请注明转载地址。 https://blog.csdn.net/qq_34829447/article/details/82691566

博主最近在学习SpringBoot,并通过项目进行深入了解。目前开发O2O校园商铺平台,将以博文的方式记录整个学习流程,github项目地址为https://github.com/Mr-WangZhe/O2O_SchoolShoppingPlat。希望我的学习记录可以给您带来一定的帮助,有问题请随时评论与我交流,谢谢!

1.创建Maven项目

  • 新建流程

    File->New->Maven Project->Next->Next->maven-archetype-webapp->填写信息->Finish
  • 添加Server Runtime右键->Build Path->Java Build Path->Library->Add Library->添加对应的服务器运行环境

  • 添加src/test/resources文件夹,并设置Java Build Path中src/test/resources的Outputfolder路径和src/test/java的Outputfolder相同

  • 修改后需要update maven项目

2.修改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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.imooc</groupId>
  <artifactId>o2o</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>o2o Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <finalName>o2o</finalName>
    <plugins><!-- 添加maven插件 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.0</version>
            <configuration>
                    <source>1.8</source><!-- 绑定jdk1.8 -->
                    <target>1.8</target>
                    <encoding>UTF8</encoding>
            </configuration>
            </plugin>
    </plugins>
  </build>
</project>

3.修改动态web工程的版本

项目右键->Build Path->Project Facets->Dynamic Web Module(默认的为2.3) 由于是eclipse的bug,没法直接修改成3.1,需要按照如下的方式进行修改:
点击Resource查看Location,并进入对应文件下的.settings文件夹,修改org.eclipse.wst.common.project.facet.core.xml文件中的动态web工程的版本为3.1

4.修改web.xml中web-app标签的规范

<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"><!-- 修改web.xml根标签web-app规范 -->
  <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>

猜你喜欢

转载自blog.csdn.net/qq_34829447/article/details/82691566