IDEA配置Maven创建Maven Web项目

基于project工程,一个工程里面包含多个模块(module)

一,配置Maven

(1)file-->Other Settings-->Setting For New Projects..

(2)配置maven文件路径选中Override:覆盖,设置好后点击Apply-->Ok

二,创建Maven Web项目

(1)file-->New-->ProJect..

 (2)Maven-->Create From archetype打对勾选择maven-archetype-webapp

(3) New Porject-->填写好后Finish

(4)打开创建好的工程依次点击src-->main-->New-->Directory-->

-->双击java

 

 依次类推-->双击resources

文件目录

 点击src-->New-->Directory-->你会发现有test和resources也一起拿到项目中

(5)配置jdk1.8

pom.xml中<build></build>标签给上一下代码段

<plugins>
      <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>
          <encoding>UTF-8</encoding>
        </configuration>
      </plugin>
</plugins>

注意:properties标签需要修改版本号 

 

(6)配置web3.0,找到web.xml修改web-app

<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"
         id="WebApp_ID" version="3.0">
  <display-name>Archetype Created Web Application</display-name>
</web-app>

(7)Maven的引入依赖

到Maven官网粘贴引入依赖

下页网址:https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api/4.0.1

 把粘贴的代码放到pomx.xml中properties和dependencies里,如图:

以下完毕后Ctrl+S保存pom.xml会自动下载jar包(也有可能是手动执行)

注意注意注意:着整个环节需要保证网络畅通,不然下载失败!!!

 进度条走完以后查看Extermal Libraries下已下载的jar包和它的依赖包啦

 

Waven配置成功,创建Maven Web项目

实有不足望请原谅

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值