**Maven**
**我为什么要学习这个技术?**
1.在Javaweb开发中,需要使用大量的jar包,我们手动去导入;
2.如何能够让一个东西自动帮我导入和配置这个jar包。
由此,Maven诞生了!
**1.1 Maven** **项目架构管理工具**
我们目前用来就是方便导入jar包的!
Maven的核心思想:**约定大于配置**
**
![](file:///C:\Users\mac\AppData\Local\Temp\ksohtml7968\wps1.png)有约束,不要去违反。
Maven会规定好你该如何去编写我们的Java代码,必须要按照这个规范来;
**1.2** **下载安装****Maven**
官网;[https://maven.apache.org/](https://maven.apache.org/)
下载完成后,解压即可;
友情建议:电脑上的所有环境都放在一个文件夹下,方便管理;
**1.3** **配置环境变量**
在我们的系统环境变量中
配置如下配置:
M2\_HOMEmaven目录下的bin目录MAVEN\_HOMEmaven的目录 在系统的path中配置%MAVEN\_HOME%\\bin
测试Maven是否安装成功,保证必须配置完毕!
**1.4** **阿里云镜像**
**
![](file:///C:\Users\mac\AppData\Local\Temp\ksohtml7968\wps2.png)镜像:mirrors
作用:加速我们的下载 国内建议使用阿里云的镜像
1
2nexus-aliyun
3\*,!jeecg,!jeecg-snapshots
4Nexus aliyun
5http://maven.aliyun.com/nexus/content/groups/public
6
**1.5** **本地仓库**
在本地的仓库,远程仓库;
**建立一个本地仓库:**localRepository
1D:\\Environment\\apache-maven-3.6.2\\maven-
repo
**1.6****、在****IDEA****中使用****Maven**
1.启动IDEA
2.创建一个MavenWeb项目
![](file:///C:\Users\mac\AppData\Local\Temp\ksohtml7968\wps3.png)3.等待项目初始化完毕
![](file:///C:\Users\mac\AppData\Local\Temp\ksohtml7968\wps4.png)4.观察maven仓库中多了什么东西?
5.IDEA中的Maven设置
注意:IDEA项目创建成功后,看一眼Maven的配置
![](file:///C:\Users\mac\AppData\Local\Temp\ksohtml7968\wps5.png)6.到这里,Maven在IDEA中的配置和使用就OK了!
**1.7****、创建一个普通的****Maven****项目**
**
![](file:///C:\Users\mac\AppData\Local\Temp\ksohtml7968\wps6.png)这个只有在Web应用下才会有!
**1.8** **标记文件夹功能**
**
![](file:///C:\Users\mac\AppData\Local\Temp\ksohtml7968\wps7.png)
![](file:///C:\Users\mac\AppData\Local\Temp\ksohtml7968\wps8.png)
**1.9** **在****IDEA****中配置****Tomcat**
![](file:///C:\Users\mac\AppData\Local\Temp\ksohtml7968\wps9.png)
![](file:///C:\Users\mac\AppData\Local\Temp\ksohtml7968\wps10.png)解决警告问题
必须要的配置:**为什么会有这个问题:我们访问一个网站,需要指定一个文件夹名字;**
**
![](file:///C:\Users\mac\AppData\Local\Temp\ksohtml7968\wps11.png)
**1.10** **pom** **文件**
pom.xml是Maven的核心配置文件
![](file:///C:\Users\mac\AppData\Local\Temp\ksohtml7968\wps12.png)1
2
3
4<project xmlns\="http://maven.apache.org/POM/4.0.0"
xmlns:xsi\="http://www.w3.org/2001/XMLSchema-instance"
5xsi:schemaLocation\="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd"\>
64.0.0
7
8
9com.kuang
10javaweb-01-maven
111.0-SNAPSHOT
12<!--Package:项目的打包方式
13jar:java应用
14war:JavaWeb应用
15\-->
16war
17
18
19
20
21
22UTF-8
23
241.8
251.8
26
27
28
29
30
31
32junit
33junit
344.11
35
36
37
<table class="MsoNormalTable" border="0" cellspacing="0" style="border-collapse:collapse;margin-left:5.4000pt;border:none;
mso-padding-alt:0.0000pt 0.0000pt 0.0000pt 0.0000pt ;"><td width="64" valign="top" style="width:32.1500pt;padding:0.0000pt 0.0000pt 0.0000pt 0.0000pt ;border-left:none;
border-right:none;border-top:none;border-bottom:none;"><p class="MsoNormal" style="margin-top:0.6000pt;margin-right:0.0000pt;margin-bottom:0.0000pt;
margin-left:0.0000pt;text-indent:0.0000pt;text-align:left;
line-height:8.8000pt;mso-line-height-rule:exactly;"><span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(153,153,153);
letter-spacing:-0.1500pt;font-size:9.0000pt;">38<span style="font-family:'Lucida Console';mso-hansi-font-family:Calibri;color:rgb(0,0,0);
font-size:9.0000pt;"><p class="MsoNormal" style="margin-top:0.0000pt;margin-right:0.0000pt;margin-bottom:0.0000pt;
margin-left:0.0000pt;text-indent:0.0000pt;text-align:left;
line-height:13.5000pt;mso-line-height-rule:exactly;"><span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(153,153,153);
letter-spacing:-0.1500pt;font-size:9.0000pt;">39<span style="font-family:'Lucida Console';mso-hansi-font-family:Calibri;color:rgb(0,0,0);
font-size:9.0000pt;"><p class="MsoNormal" style="margin-top:0.0000pt;margin-right:0.0000pt;margin-bottom:0.0000pt;
margin-left:0.0000pt;text-indent:0.0000pt;text-align:left;
line-height:13.5000pt;mso-line-height-rule:exactly;"><span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(153,153,153);
letter-spacing:-0.1500pt;font-size:9.0000pt;">40<span style="font-family:'Lucida Console';mso-hansi-font-family:Calibri;color:rgb(0,0,0);
font-size:9.0000pt;"><td width="2" valign="top" style="width:1.0000pt;padding:0.0000pt 0.0000pt 0.0000pt 0.0000pt ;border-left:none;
border-right:none;border-top:none;border-bottom:none;"><p class="MsoNormal" style="margin-top:0.0000pt;margin-right:0.0000pt;margin-bottom:0.0000pt;
margin-left:0.0000pt;text-indent:0.0000pt;text-align:left;
mso-line-height-alt:0pt;"><span style="font-family:'Lucida Console';mso-hansi-font-family:Calibri;color:rgb(0,0,0);
font-size:9.0000pt;"> <td width="441" valign="top" style="width:220.8500pt;padding:0.0000pt 0.0000pt 0.0000pt 0.0000pt ;border-left:none;
border-right:none;border-top:none;border-bottom:none;"><p class="MsoNormal" style="margin-top:0.0000pt;margin-right:0.0000pt;margin-bottom:0.0000pt;
margin-left:0.0000pt;text-indent:0.0000pt;text-align:left;
line-height:8.8000pt;mso-line-height-rule:exactly;"><span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(170,85,0);
letter-spacing:-0.1500pt;font-size:9.0000pt;"><!--<span style="mso-spacerun:'yes';font-family:新宋体;mso-fareast-font-family:'Times New Roman';
color:rgb(170,85,0);letter-spacing:-0.2000pt;font-size:9.0000pt;">项目构建用的东西<span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(170,85,0);
letter-spacing:-0.1500pt;font-size:9.0000pt;">--><span style="font-family:'Lucida Console';mso-hansi-font-family:Calibri;color:rgb(0,0,0);
font-size:9.0000pt;"><p class="MsoNormal" style="margin-top:4.7500pt;margin-right:0.0000pt;margin-bottom:0.0000pt;
margin-left:0.0000pt;text-indent:0.0000pt;text-align:left;
line-height:8.8000pt;mso-line-height-rule:exactly;"><span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(17,119,0);
letter-spacing:-0.1500pt;font-size:9.0000pt;"><build><span style="font-family:'Lucida Console';mso-hansi-font-family:Calibri;color:rgb(0,0,0);
font-size:9.0000pt;"><p class="MsoNormal" style="margin-top:4.7500pt;margin-right:0.0000pt;margin-bottom:0.0000pt;
margin-left:10.6000pt;text-indent:0.0000pt;text-align:left;
line-height:8.8000pt;mso-line-height-rule:exactly;"><span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(17,119,0);
letter-spacing:-0.1500pt;font-size:9.0000pt;"><finalName><span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(51,51,51);
letter-spacing:-0.1500pt;font-size:9.0000pt;">javaweb-01-maven<span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(17,119,0);
letter-spacing:-0.1500pt;font-size:9.0000pt;"></finalName><span style="font-family:'Lucida Console';mso-hansi-font-family:Calibri;color:rgb(0,0,0);
font-size:9.0000pt;">
![](file:///C:\Users\mac\AppData\Local\Temp\ksohtml7968\wps13.png)41<!-- lock down plugins versions to avoid using Maven
defaults (may be moved to parent pom) -->
42
43
44maven-clean-plugin
453.1.0
46
47<!-- see http://maven.apache.org/ref/current/maven-core/default-
bindings.html#Plugin\_bindings\_for\_war\_packaging -->
48
49maven-resources-plugin
503.0.2
51
52
53maven-compiler-plugin
543.8.0
55
56
57maven-surefire-plugin
582.22.1
<table class="MsoNormalTable" border="0" cellspacing="0" style="border-collapse:collapse;margin-left:5.4000pt;border:none;
mso-padding-alt:0.0000pt 0.0000pt 0.0000pt 0.0000pt ;"><td width="85" valign="top" style="width:42.7500pt;padding:0.0000pt 0.0000pt 0.0000pt 0.0000pt ;border-left:none;
border-right:none;border-top:none;border-bottom:none;"><p class="MsoNormal" style="margin-top:0.0000pt;margin-right:0.0000pt;margin-bottom:0.0000pt;
margin-left:0.0000pt;text-indent:0.0000pt;text-align:left;
line-height:8.8000pt;mso-line-height-rule:exactly;"><span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(153,153,153);
letter-spacing:-0.1500pt;font-size:9.0000pt;">59<span style="font-family:'Lucida Console';mso-hansi-font-family:Calibri;color:rgb(0,0,0);
font-size:9.0000pt;"><p class="MsoNormal" style="margin-top:0.0000pt;margin-right:0.0000pt;margin-bottom:0.0000pt;
margin-left:0.0000pt;text-indent:0.0000pt;text-align:left;
line-height:13.5000pt;mso-line-height-rule:exactly;"><span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(153,153,153);
letter-spacing:-0.1500pt;font-size:9.0000pt;">60<span style="font-family:'Lucida Console';mso-hansi-font-family:Calibri;color:rgb(0,0,0);
font-size:9.0000pt;"><p class="MsoNormal" style="margin-top:0.0000pt;margin-right:0.0000pt;margin-bottom:0.0000pt;
margin-left:0.0000pt;text-indent:0.0000pt;text-align:left;
line-height:13.5000pt;mso-line-height-rule:exactly;"><span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(153,153,153);
letter-spacing:-0.1500pt;font-size:9.0000pt;">61<span style="font-family:'Lucida Console';mso-hansi-font-family:Calibri;color:rgb(0,0,0);
font-size:9.0000pt;"><p class="MsoNormal" style="margin-top:0.0000pt;margin-right:0.0000pt;margin-bottom:0.0000pt;
margin-left:0.0000pt;text-indent:0.0000pt;text-align:left;
line-height:13.5000pt;mso-line-height-rule:exactly;"><span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(153,153,153);
letter-spacing:-0.1500pt;font-size:9.0000pt;">62<span style="font-family:'Lucida Console';mso-hansi-font-family:Calibri;color:rgb(0,0,0);
font-size:9.0000pt;"><p class="MsoNormal" style="margin-top:0.0000pt;margin-right:0.0000pt;margin-bottom:0.0000pt;
margin-left:0.0000pt;text-indent:0.0000pt;text-align:left;
line-height:13.5000pt;mso-line-height-rule:exactly;"><span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(153,153,153);
letter-spacing:-0.1500pt;font-size:9.0000pt;">63<span style="font-family:'Lucida Console';mso-hansi-font-family:Calibri;color:rgb(0,0,0);
font-size:9.0000pt;"><p class="MsoNormal" style="margin-top:0.0000pt;margin-right:0.0000pt;margin-bottom:0.0000pt;
margin-left:0.0000pt;text-indent:0.0000pt;text-align:left;
line-height:13.5000pt;mso-line-height-rule:exactly;"><span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(153,153,153);
letter-spacing:-0.1500pt;font-size:9.0000pt;">64<span style="font-family:'Lucida Console';mso-hansi-font-family:Calibri;color:rgb(0,0,0);
font-size:9.0000pt;"><p class="MsoNormal" style="margin-top:0.0000pt;margin-right:0.0000pt;margin-bottom:0.0000pt;
margin-left:0.0000pt;text-indent:0.0000pt;text-align:left;
line-height:13.5000pt;mso-line-height-rule:exactly;"><span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(153,153,153);
letter-spacing:-0.1500pt;font-size:9.0000pt;">65<span style="font-family:'Lucida Console';mso-hansi-font-family:Calibri;color:rgb(0,0,0);
font-size:9.0000pt;"><p class="MsoNormal" style="margin-top:0.0000pt;margin-right:0.0000pt;margin-bottom:0.0000pt;
margin-left:0.0000pt;text-indent:0.0000pt;text-align:left;
line-height:13.5000pt;mso-line-height-rule:exactly;"><span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(153,153,153);
letter-spacing:-0.1500pt;font-size:9.0000pt;">66<span style="font-family:'Lucida Console';mso-hansi-font-family:Calibri;color:rgb(0,0,0);
font-size:9.0000pt;"><p class="MsoNormal" style="margin-top:0.0000pt;margin-right:0.0000pt;margin-bottom:0.0000pt;
margin-left:0.0000pt;text-indent:0.0000pt;text-align:left;
line-height:13.5000pt;mso-line-height-rule:exactly;"><span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(153,153,153);
letter-spacing:-0.1500pt;font-size:9.0000pt;">67<span style="font-family:'Lucida Console';mso-hansi-font-family:Calibri;color:rgb(0,0,0);
font-size:9.0000pt;"><p class="MsoNormal" style="margin-top:0.0000pt;margin-right:0.0000pt;margin-bottom:0.0000pt;
margin-left:0.0000pt;text-indent:0.0000pt;text-align:left;
line-height:13.5000pt;mso-line-height-rule:exactly;"><span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(153,153,153);
letter-spacing:-0.1500pt;font-size:9.0000pt;">68<span style="font-family:'Lucida Console';mso-hansi-font-family:Calibri;color:rgb(0,0,0);
font-size:9.0000pt;"><p class="MsoNormal" style="margin-top:0.0000pt;margin-right:0.0000pt;margin-bottom:0.0000pt;
margin-left:0.0000pt;text-indent:0.0000pt;text-align:left;
line-height:13.5000pt;mso-line-height-rule:exactly;"><span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(153,153,153);
letter-spacing:-0.1500pt;font-size:9.0000pt;">69<span style="font-family:'Lucida Console';mso-hansi-font-family:Calibri;color:rgb(0,0,0);
font-size:9.0000pt;"><p class="MsoNormal" style="margin-top:0.0000pt;margin-right:0.0000pt;margin-bottom:0.0000pt;
margin-left:0.0000pt;text-indent:0.0000pt;text-align:left;
line-height:13.5000pt;mso-line-height-rule:exactly;"><span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(153,153,153);
letter-spacing:-0.1500pt;font-size:9.0000pt;">70<span style="font-family:'Lucida Console';mso-hansi-font-family:Calibri;color:rgb(0,0,0);
font-size:9.0000pt;"><p class="MsoNormal" style="margin-top:0.0000pt;margin-right:0.0000pt;margin-bottom:0.0000pt;
margin-left:0.0000pt;text-indent:0.0000pt;text-align:left;
line-height:13.5000pt;mso-line-height-rule:exactly;"><span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(153,153,153);
letter-spacing:-0.1500pt;font-size:9.0000pt;">71<span style="font-family:'Lucida Console';mso-hansi-font-family:Calibri;color:rgb(0,0,0);
font-size:9.0000pt;"><p class="MsoNormal" style="margin-top:0.0000pt;margin-right:0.0000pt;margin-bottom:0.0000pt;
margin-left:0.0000pt;text-indent:0.0000pt;text-align:left;
line-height:13.5000pt;mso-line-height-rule:exactly;"><span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(153,153,153);
letter-spacing:-0.1500pt;font-size:9.0000pt;">72<span style="font-family:'Lucida Console';mso-hansi-font-family:Calibri;color:rgb(0,0,0);
font-size:9.0000pt;"><p class="MsoNormal" style="margin-top:0.0000pt;margin-right:0.0000pt;margin-bottom:0.0000pt;
margin-left:0.0000pt;text-indent:0.0000pt;text-align:left;
line-height:13.5000pt;mso-line-height-rule:exactly;"><span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(153,153,153);
letter-spacing:-0.1500pt;font-size:9.0000pt;">73<span style="font-family:'Lucida Console';mso-hansi-font-family:Calibri;color:rgb(0,0,0);
font-size:9.0000pt;"><td width="2" valign="top" style="width:1.0000pt;padding:0.0000pt 0.0000pt 0.0000pt 0.0000pt ;border-left:none;
border-right:none;border-top:none;border-bottom:none;"><p class="MsoNormal" style="margin-top:0.0000pt;margin-right:0.0000pt;margin-bottom:0.0000pt;
margin-left:0.0000pt;text-indent:0.0000pt;text-align:left;
mso-line-height-alt:0pt;"><span style="font-family:'Lucida Console';mso-hansi-font-family:Calibri;color:rgb(0,0,0);
font-size:9.0000pt;"> <td width="547" valign="top" style="width:273.7500pt;padding:0.0000pt 0.0000pt 0.0000pt 0.0000pt ;border-left:none;
border-right:none;border-top:none;border-bottom:none;"><p class="MsoNormal" style="margin-top:0.0000pt;margin-right:0.0000pt;margin-bottom:0.0000pt;
margin-left:21.1500pt;text-indent:0.0000pt;text-align:left;
line-height:8.8000pt;mso-line-height-rule:exactly;"><span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(17,119,0);
letter-spacing:-0.1500pt;font-size:9.0000pt;"></plugin><span style="font-family:'Lucida Console';mso-hansi-font-family:Calibri;color:rgb(0,0,0);
font-size:9.0000pt;"><p class="MsoNormal" style="margin-top:4.7500pt;margin-right:0.0000pt;margin-bottom:0.0000pt;
margin-left:21.1500pt;text-indent:0.0000pt;text-align:left;
line-height:8.8000pt;mso-line-height-rule:exactly;"><span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(17,119,0);
letter-spacing:-0.1500pt;font-size:9.0000pt;"><plugin><span style="font-family:'Lucida Console';mso-hansi-font-family:Calibri;color:rgb(0,0,0);
font-size:9.0000pt;"><p class="MsoNormal" style="margin-top:4.7500pt;margin-right:0.0000pt;margin-bottom:0.0000pt;
margin-left:31.7500pt;text-indent:0.0000pt;text-align:left;
line-height:8.8000pt;mso-line-height-rule:exactly;"><span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(17,119,0);
letter-spacing:-0.1500pt;font-size:9.0000pt;"><artifactId><span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(51,51,51);
letter-spacing:-0.1500pt;font-size:9.0000pt;">maven-war-plugin<span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(17,119,0);
letter-spacing:-0.1500pt;font-size:9.0000pt;"></artifactId><span style="font-family:'Lucida Console';mso-hansi-font-family:Calibri;color:rgb(0,0,0);
font-size:9.0000pt;"><p class="MsoNormal" style="margin-top:4.7500pt;margin-right:0.0000pt;margin-bottom:0.0000pt;
margin-left:31.7500pt;text-indent:0.0000pt;text-align:left;
line-height:8.8000pt;mso-line-height-rule:exactly;"><span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(17,119,0);
letter-spacing:-0.1500pt;font-size:9.0000pt;"><version><span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(51,51,51);
letter-spacing:-0.1500pt;font-size:9.0000pt;">3.2.2<span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(17,119,0);
letter-spacing:-0.1500pt;font-size:9.0000pt;"></version><span style="font-family:'Lucida Console';mso-hansi-font-family:Calibri;color:rgb(0,0,0);
font-size:9.0000pt;"><p class="MsoNormal" style="margin-top:4.7500pt;margin-right:0.0000pt;margin-bottom:0.0000pt;
margin-left:21.1500pt;text-indent:0.0000pt;text-align:left;
line-height:8.8000pt;mso-line-height-rule:exactly;"><span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(17,119,0);
letter-spacing:-0.1500pt;font-size:9.0000pt;"></plugin><span style="font-family:'Lucida Console';mso-hansi-font-family:Calibri;color:rgb(0,0,0);
font-size:9.0000pt;"><p class="MsoNormal" style="margin-top:4.7500pt;margin-right:0.0000pt;margin-bottom:0.0000pt;
margin-left:21.1500pt;text-indent:0.0000pt;text-align:left;
line-height:8.8000pt;mso-line-height-rule:exactly;"><span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(17,119,0);
letter-spacing:-0.1500pt;font-size:9.0000pt;"><plugin><span style="font-family:'Lucida Console';mso-hansi-font-family:Calibri;color:rgb(0,0,0);
font-size:9.0000pt;"><p class="MsoNormal" style="margin-top:4.7500pt;margin-right:0.0000pt;margin-bottom:0.0000pt;
margin-left:31.7500pt;text-indent:0.0000pt;text-align:left;
line-height:8.8000pt;mso-line-height-rule:exactly;"><span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(17,119,0);
letter-spacing:-0.1500pt;font-size:9.0000pt;"><artifactId><span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(51,51,51);
letter-spacing:-0.1500pt;font-size:9.0000pt;">maven-install-plugin<span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(17,119,0);
letter-spacing:-0.1500pt;font-size:9.0000pt;"></artifactId><span style="font-family:'Lucida Console';mso-hansi-font-family:Calibri;color:rgb(0,0,0);
font-size:9.0000pt;"><p class="MsoNormal" style="margin-top:4.7500pt;margin-right:0.0000pt;margin-bottom:0.0000pt;
margin-left:21.1500pt;text-indent:0.0000pt;text-align:left;
line-height:8.8000pt;mso-line-height-rule:exactly;"><span style="font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';mso-hansi-font-family:Calibri;
mso-bidi-font-family:'Times New Roman';color:rgb(17,119,0);letter-spacing:5.1500pt;
font-size:9.0000pt;"> <span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(17,119,0);
letter-spacing:-0.1500pt;font-size:9.0000pt;"><version><span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(51,51,51);
letter-spacing:-0.1500pt;font-size:9.0000pt;">2.5.2<span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(17,119,0);
letter-spacing:-0.1500pt;font-size:9.0000pt;"></version><span style="font-family:'Lucida Console';mso-hansi-font-family:Calibri;color:rgb(0,0,0);
font-size:9.0000pt;"><p class="MsoNormal" style="margin-top:0.0000pt;margin-right:0.0000pt;margin-bottom:0.0000pt;
margin-left:21.1500pt;text-indent:0.0000pt;text-align:left;
line-height:13.5000pt;mso-line-height-rule:exactly;"><span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(17,119,0);
letter-spacing:-0.1500pt;font-size:9.0000pt;"></plugin><span style="font-family:'Lucida Console';mso-hansi-font-family:Calibri;color:rgb(0,0,0);
font-size:9.0000pt;"><p class="MsoNormal" style="margin-top:4.7500pt;margin-right:0.0000pt;margin-bottom:0.0000pt;
margin-left:21.1500pt;text-indent:0.0000pt;text-align:left;
line-height:8.8000pt;mso-line-height-rule:exactly;"><span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(17,119,0);
letter-spacing:-0.1500pt;font-size:9.0000pt;"><plugin><span style="font-family:'Lucida Console';mso-hansi-font-family:Calibri;color:rgb(0,0,0);
font-size:9.0000pt;"><p class="MsoNormal" style="margin-top:4.7500pt;margin-right:0.0000pt;margin-bottom:0.0000pt;
margin-left:21.1500pt;text-indent:0.0000pt;text-align:left;
line-height:8.8000pt;mso-line-height-rule:exactly;"><span style="font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';mso-hansi-font-family:Calibri;
mso-bidi-font-family:'Times New Roman';color:rgb(17,119,0);letter-spacing:5.1500pt;
font-size:9.0000pt;"> <span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(17,119,0);
letter-spacing:-0.1500pt;font-size:9.0000pt;"><artifactId><span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(51,51,51);
letter-spacing:-0.1500pt;font-size:9.0000pt;">maven-deploy-plugin<span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(17,119,0);
letter-spacing:-0.1500pt;font-size:9.0000pt;"></artifactId><span style="font-family:'Lucida Console';mso-hansi-font-family:Calibri;color:rgb(0,0,0);
font-size:9.0000pt;"><p class="MsoNormal" style="margin-top:0.0000pt;margin-right:0.0000pt;margin-bottom:0.0000pt;
margin-left:21.1500pt;text-indent:0.0000pt;text-align:left;
line-height:13.5000pt;mso-line-height-rule:exactly;"><span style="font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';mso-hansi-font-family:Calibri;
mso-bidi-font-family:'Times New Roman';color:rgb(17,119,0);letter-spacing:5.1500pt;
font-size:9.0000pt;"> <span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(17,119,0);
letter-spacing:-0.1500pt;font-size:9.0000pt;"><version><span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(51,51,51);
letter-spacing:-0.1500pt;font-size:9.0000pt;">2.8.2<span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(17,119,0);
letter-spacing:-0.1500pt;font-size:9.0000pt;"></version><span style="font-family:'Lucida Console';mso-hansi-font-family:Calibri;color:rgb(0,0,0);
font-size:9.0000pt;"><p class="MsoNormal" style="margin-top:0.0000pt;margin-right:0.0000pt;margin-bottom:0.0000pt;
margin-left:21.1500pt;text-indent:0.0000pt;text-align:left;
line-height:13.5000pt;mso-line-height-rule:exactly;"><span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(17,119,0);
letter-spacing:-0.1500pt;font-size:9.0000pt;"></plugin><span style="font-family:'Lucida Console';mso-hansi-font-family:Calibri;color:rgb(0,0,0);
font-size:9.0000pt;"><p class="MsoNormal" style="margin-top:4.7500pt;margin-right:0.0000pt;margin-bottom:0.0000pt;
margin-left:10.6000pt;text-indent:0.0000pt;text-align:left;
line-height:8.8000pt;mso-line-height-rule:exactly;"><span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(17,119,0);
letter-spacing:-0.1500pt;font-size:9.0000pt;"></plugins><span style="font-family:'Lucida Console';mso-hansi-font-family:Calibri;color:rgb(0,0,0);
font-size:9.0000pt;"><p class="MsoNormal" style="margin-top:4.7500pt;margin-right:0.0000pt;margin-bottom:0.0000pt;
margin-left:0.0000pt;text-indent:0.0000pt;text-align:left;
line-height:8.8000pt;mso-line-height-rule:exactly;"><span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(17,119,0);
letter-spacing:-0.1500pt;font-size:9.0000pt;"></pluginManagement><span style="font-family:'Lucida Console';mso-hansi-font-family:Calibri;color:rgb(0,0,0);
font-size:9.0000pt;">
74
75
76
![](file:///C:\Users\mac\AppData\Local\Temp\ksohtml7968\wps14.png)maven由于他的约定大于配置,我们之后可以能遇到我们写的配置文件,无法被导出或者生效的问题, 解决方案:
1
2
3
4
5src/main/resources
6
7\*\*/\*.properties
8\*\*/\*.xml
9
10true
11
12
13src/main/java
14
15\*\*/\*.properties
16\*\*/\*.xml
17
18true
19
<table class="MsoNormalTable" border="0" cellspacing="0" style="border-collapse:collapse;margin-left:5.4000pt;border:none;
mso-padding-alt:0.0000pt 0.0000pt 0.0000pt 0.0000pt ;"><td width="22" valign="top" style="width:11.2000pt;padding:0.0000pt 0.0000pt 0.0000pt 0.0000pt ;border-left:none;
border-right:none;border-top:none;border-bottom:none;"><p class="MsoNormal" style="margin-top:0.0000pt;margin-right:0.0000pt;margin-bottom:0.0000pt;
margin-left:0.0000pt;text-indent:0.0000pt;text-align:left;
mso-line-height-alt:0pt;"><span style="font-family:'Lucida Console';mso-hansi-font-family:Calibri;color:rgb(0,0,0);
font-size:9.0000pt;"> <td width="43" valign="top" style="width:21.6000pt;padding:0.0000pt 0.0000pt 0.0000pt 0.0000pt ;border-left:none;
border-right:none;border-top:none;border-bottom:none;"><p class="MsoNormal" style="margin-top:0.0000pt;margin-right:0.0000pt;margin-bottom:0.0000pt;
margin-left:0.0000pt;text-indent:0.0000pt;text-align:left;
line-height:8.8000pt;mso-line-height-rule:exactly;"><span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(153,153,153);
letter-spacing:-0.1500pt;font-size:9.0000pt;">20<span style="font-family:'Lucida Console';mso-hansi-font-family:Calibri;color:rgb(0,0,0);
font-size:9.0000pt;"><p class="MsoNormal" style="margin-top:4.7500pt;margin-right:0.0000pt;margin-bottom:0.0000pt;
margin-left:0.0000pt;text-indent:0.0000pt;text-align:left;
line-height:8.8000pt;mso-line-height-rule:exactly;"><span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(153,153,153);
letter-spacing:-0.1500pt;font-size:9.0000pt;">21<span style="font-family:'Lucida Console';mso-hansi-font-family:Calibri;color:rgb(0,0,0);
font-size:9.0000pt;"><td width="2" valign="top" style="width:1.0000pt;padding:0.0000pt 0.0000pt 0.0000pt 0.0000pt ;border-left:none;
border-right:none;border-top:none;border-bottom:none;"><p class="MsoNormal" style="margin-top:0.0000pt;margin-right:0.0000pt;margin-bottom:0.0000pt;
margin-left:0.0000pt;text-indent:0.0000pt;text-align:left;
mso-line-height-alt:0pt;"><span style="font-family:'Lucida Console';mso-hansi-font-family:Calibri;color:rgb(0,0,0);
font-size:9.0000pt;"> <td width="177" valign="top" style="width:88.6000pt;padding:0.0000pt 0.0000pt 0.0000pt 0.0000pt ;border-left:none;
border-right:none;border-top:none;border-bottom:none;"><p class="MsoNormal" style="margin-top:0.0000pt;margin-right:0.0000pt;margin-bottom:0.0000pt;
margin-left:21.1500pt;text-indent:0.0000pt;text-align:left;
line-height:8.8000pt;mso-line-height-rule:exactly;"><span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(17,119,0);
letter-spacing:-0.1500pt;font-size:9.0000pt;"></resources><span style="font-family:'Lucida Console';mso-hansi-font-family:Calibri;color:rgb(0,0,0);
font-size:9.0000pt;"><p class="MsoNormal" style="margin-top:4.7500pt;margin-right:0.0000pt;margin-bottom:0.0000pt;
margin-left:0.0000pt;text-indent:0.0000pt;text-align:left;
line-height:8.8000pt;mso-line-height-rule:exactly;"><span style="mso-spacerun:'yes';font-family:'Lucida Console';mso-fareast-font-family:'Times New Roman';
mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';color:rgb(17,119,0);
letter-spacing:-0.1500pt;font-size:9.0000pt;"></build><span style="font-family:'Lucida Console';mso-hansi-font-family:Calibri;color:rgb(0,0,0);
font-size:9.0000pt;">
**1.12 IDEA****操作**
**
![](file:///C:\Users\mac\AppData\Local\Temp\ksohtml7968\wps15.png)
**1.13** **解决遇到的问题**
1.Maven3.6.2
解决方法:降级为3.6.1
2.Tomcat闪退
3.IDEA中每次都要重复配置Maven在IDEA中的全局默认配置中去配置
![](file:///C:\Users\mac\AppData\Local\Temp\ksohtml7968\wps16.png)4.Maven项目中Tomcat无法配置
5.maven默认web项目中的web.xml版本问题
6.替换为webapp4.0版本和tomcat一致
1
2<web-app xmlns\="http://xmlns.jcp.org/xml/ns/javaee"
3xmlns:xsi\="http://www.w3.org/2001/XMLSchema-instance"
4xsi:schemaLocation\="http://xmlns.jcp.org/xml/ns/javaee
5http://xmlns.jcp.org/xml/ns/javaee/web-
app\_4\_0.xsd"
6version\="4.0"
7metadata-complete\="true"\>
8
9
10
11
7.Maven仓库的使用
地址:[https://mvnrepository.com/](https://mvnrepository.com/)
![](file:///C:\Users\mac\AppData\Local\Temp\ksohtml7968\wps17.png)
************
- Java Web项目开发学习手册
- 一、B/S开发环境搭建
- 1.1 tomcat服务器目录结构及作用
- 1.2 在IDE开发工具上配置tomcat服务器
- 1.3 简单web项目在tomcat服务器上运行的方法
- 1.4 开发工具设置
- 1.5 总结
- 二、Servlet技术应用
- 2.1 HttpServlet中的主要方法及应用
- 2.1.1 基于Eclipse完成一个JavaWeb项目
- 2.2 HttpRequest,HttpResponse的应用
- 2.2.1客户端请求
- 2.2.2服务器响应
- 2.2.3Servlet HTTP 状态码
- 2.2.4图片验证码类
- 2.2.5注册模拟实现(带验证码)
- 2.3 ServletConfig对象和ServletContext对象的概念
- 2.4 总结
- 三、JSP技术应用
- 3.1 JSP基本语法
- 3.2 JSP标签和指令
- 3.3 JSP中的隐式对象
- 3.4 常用应用操作
- 3.4.1 JSP客户端请求
- 3.4.2 JSP服务器响应
- 3.4.3 HTTP状态码
- 3.4.4 表单处理
- 3.4.5 过滤器
- 3.4.6 Cookie处理
- 3.4.7 Session处理
- 3.4.8 文件上传
- 3.4.9 日期处理
- 3.4.10 页面重定向
- 3.4.11 点击量统计
- 3.4.12 自动刷新
- 3.4.13 发送邮件
- 3.5 JSP高级应用
- 3.5.1 JSP标准标签库(JSTL)
- 3.5.2 JSP连接数据库
- 3.5.3 JSP XML数据处理
- 3.5.4 JSP JavaBean
- 3.5.5 自定义标签
- 3.5.6 表达式语言
- 3.5.7 异常处理
- 3.5.8 调试
- 3.5.9 JSP国际化
- 3.6 实践代码
- 3.6.1 实践代码
- 3.6.2 项目实战
- 3.7 总结
- 四、MVC思想的理解和搭建MVC
- 4.1 MVC设计模式的思想
- 4.2 MVC设计模式的实现步骤
- 4.3 项目实践
- 4.4 总结
- 五、EL表达式和JSTL技术
- 5.1 EL表达式及其应用
- 5.2 常用的JSTL标签的应用
- 5.3 项目实践
- 5.4 总结
- 六、Cookie和Session
- 6.1 cookie对象的概念和应用
- 6.2 session对象的概念和应用
- 6.3 项目实践
- 6.4 总结
- 七、过滤器技术应用
- 7.1 Filter的概念及应用
- 7.2 Filter、FilterChain、FilterConfig 介绍
- 7.3 用户登录过滤案例
- 7.4 项目实战
- 7.5总结
- 八、异步请求技术
- 8.1 JSON数据格式
- 8.2 使用AJAX实现异步请求
- 8.3 用户名校验案例
- 8.4小结
- 综合项目技术实训
- 1.BS项目开发项目实战
- 2.项目需求分析和系统设计
- 2.1需求分析
- 2.2类型模型设计
- 2.3原型设计
- 3.项目数据库分析和系统设计
- 4.BS项目编程实现
- 4.1搭建框架和命名规约
- 4.2实现步骤
- 4.2.1创建实体类
- 4.2.2创建过滤器类
- 4.2.3创建工具类
- 4.2.4创建DAO接口及其实现类
- 4.2.5创建Service接口及其实现类
- 4.2.6创建测试类
- 4.2.7创建控制器类
- 5.企业开发流程规范
- 6.总结
- 九、练习题及答案
- 企业开发常用技术
- 1.Maven技术
- Java命名规范解读
- 参考资料
- 开发中常用的应用服务器和Web服务器