1. 程式人生 > >SSM學習-新建Maven工程

SSM學習-新建Maven工程

targe servers def repos pmp webapp 錯誤 plugin lns

  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工程的文件。

SSM學習-新建Maven工程