SSM学习-1.新建Maven工程

  1.创建Maven工程

  1.1 用elcipse新建一个简单的maven工程

  

  

  1.2 设置maven工程的setting.xml配置文件

  

  setting.xml配置如下

<?xml version="1.0" encoding="UTF-8"?>

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

    <localRepository>D:/maven/my_local_repository</localRepository>

    <pluginGroups>
    </pluginGroups>

    <proxies>
    </proxies>

    <servers>
    </servers>

    <mirrors>
       
        <mirror>
            <id>alimaven</id>
            <name>aliyun maven</name>
            <mirrorOf>central</mirrorOf>
           <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
        </mirror>
       
        
    </mirrors>

    <profiles>
        <profile>
            <id>jdk17</id>
            <activation>
                <activeByDefault>true</activeByDefault>
                <jdk>1.7</jdk>
            </activation>
            <properties>
                <maven.compiler.source>1.7</maven.compiler.source>
                <maven.compiler.target>1.7</maven.compiler.target>
                <maven.compiler.cpmpilerVersion>1.7</maven.compiler.cpmpilerVersion>
            </properties>
        </profile>
    </profiles>


</settings>

  1.3 添加web.xml文件

  在新建的项目中会出现如下错误

  

  这个问题是由于web项目没有生成web.xml导致的,所以我们需要添加一个web.xml。

  右键选择项目的peoperties,找到maven下Project Facets下的Dynamic Web Module,将其选中的勾去掉在确定,然后重新勾选

   

  点击apply and close之后,就可以看到我们项目下src/main/webapp中生成了web工程的文件。

 

posted @ 2017-09-06 16:06  学而时习之,不亦说乎?  阅读(210)  评论(0编辑  收藏  举报