eclipse创建maven项目

来源:互联网 发布:淘宝联盟api如何使用 编辑:程序博客网 时间:2024/06/16 22:08

第一步:点击File-New-Oter-Maven project-然后选择 archphe-webapp结尾的类型(创建web的maven项目),然后输入artifacid的名字(也就是项目名称)

第二步:注意:这里创建的是2.3版本的,现在maven使用的大部分最低是2.5,我这里直接用3.0的

第三步:解决maven低版本:点击navigator,然后点击项目的.settings中的org.eclipse.wst.common.project.facet.core.xml,修改jdk版本与项目版本

第四步:修改web.xml文件,内容如下:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
  <display-name>new_spring</display-name>
  <welcome-file-list>
  <welcome-file>index.html</welcome-file>
  <welcome-file>index.htm</welcome-file>
  <welcome-file>index.jsp</welcome-file>
  <welcome-file>default.html</welcome-file>
  <welcome-file>default.htm</welcome-file>
  <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
</web-app>

第五步:注意这里项目缺少目录,得创建src-main-java、src-test-java、src-test-resources创建

第六步:点击项目,alt+enter,点击project facts 选择jdk与项目dynimic web modules选择3.0,这样就大功告成了



0 0
原创粉丝点击