目录
2.1 IDEA 2022 兼容maven 3.8.1及之前的所有版本
2.2 IDEA 2021 兼容maven 3.8.1及之前的所有版本
2.3 IDEA 2022 兼容Maven 3.6.4 及之前的所有版本
编辑 2.4 IDEA 2018 兼容Maven 3.6.1及之前的所有版本
1、管理依赖
2、完整的声明周期可以生成测试报告
3、聚合工程的构建方式

2.1 IDEA 2022 兼容maven 3.8.1及之前的所有版本

2.4 IDEA 2018 兼容Maven 3.6.1及之前的所有版本 
其实各大IDE都集成了maven,如果实在不行就使用IDE自带的Maven版本
maven的目录结构

maven根据我们构建信息将需要的依赖从中央仓库或者远程仓库下载到本地指定的文件夹
这个文件夹就是本地仓库
maven维护,当前主流的项目的依赖全部存储在中央仓库中。默认采用的国外的站点(下载速度过慢)
我们一般采用 阿里镜像 华为镜像
存放的是企业内部的第三方依赖,只供本企业访问

找到下面的settings.xml 文件夹
设置本地仓库是哪个

我们改为阿里的镜像 ---因为maven的镜像是国外的服务器部署的,我们访问是非常慢的
- <mirror>
- <id>alimavenid>
- <name>aliyun mavenname>
- <url>http://maven.aliyun.com/nexus/content/groups/public/url>
- <mirrorOf>centralmirrorOf>
- mirror>

M2_HOME:maven 的根目录path 中增 %M2_HOME%/bin
项目的名称
|---src 存放文件和源文件和配置文件
|--main 运行时的源文件
|--java 存放java源文件
|--resource java的配置文件
|--test 测试时的源文件和配置文件
|--java 存放java源文件
|--resource java的配置文件
|--target 存放的是编译和打包后的文件
|-- pom.xml 构建的描述信息
项目的名称
|---src 存放文件的配置文件和源文件
|-- main 运行时的源文件
|-- java
|--resource
|--webapp
|--WEB-INF
|--web.xml
|--test 测试时的源文件和配置文件
|-- java
|--resource
|--target 存放的编译和打包后的文件
|--pom.xml 构建的描述信息
编译,将源码编译到target中,编译为字节码文件
清除target目录
执行test目录的单元测试,并生成测试报告,采用断言机制
打包,将java打包为jar 将java web 打包为war
安装,将打包后的jar文件安装到本地仓库中,按照本地仓库的安装格式。可可以讲我们自定义的项目作为maven依赖使用
将项目部署到私服上









- <project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
-
- <modelVersion>4.0.0modelVersion>
-
-
- <groupId>con.sofwingroupId>
- <artifactId>maven_01_testartifactId>
- <version>1.0-SNAPSHOTversion>
-
- <packaging>warpackaging>
-
-
- <properties>
- <springmvc-version>5.0.5.RELEASEspringmvc-version>
- properties>
-
-
- <dependencies>
- <dependency>
-
- <groupId>org.springframeworkgroupId>
-
- <artifactId>spring-webmvcartifactId>
-
- <version>${springmvc-version}version>
-
-
- dependency>
- <dependency>
-
- <groupId>javax.servletgroupId>
- <artifactId>servlet-apiartifactId>
- <version>2.5version>
- <scope>providedscope>
-
-
-
-
-
-
-
- dependency>
-
-
- <dependency>
- <groupId>org.mybatis.generatorgroupId>
- <artifactId>mybatis-generator-coreartifactId>
- <version>1.3.7version>
- dependency>
-
- <dependency>
- <groupId>org.mybatisgroupId>
- <artifactId>mybatisartifactId>
- <version>3.5.9version>
- dependency>
-
- <dependency>
- <groupId>mysqlgroupId>
- <artifactId>mysql-connector-javaartifactId>
- <version>8.0.28version>
-
- dependency>
-
- <dependency>
- <groupId>junitgroupId>
- <artifactId>junitartifactId>
- <version>4.12version>
- dependency>
-
- <dependency>
- <groupId>org.apache.logging.log4jgroupId>
- <artifactId>log4j-coreartifactId>
- <version>2.9.1version>
- dependency>
- dependencies>
-
-
- <build>
-
- <finalName>RootWEntaofinalName>
-
- <resources>
-
- <resource>
- <directory>src/main/java/directory>
- <includes>
- <include>**/*.xmlinclude>
- includes>
- resource>
- <resource>
- <directory>src/main/resources/directory>
- <includes>
- <include>**/*.propertiesinclude>
- <include>**/*.xmlinclude>
- includes>
- resource>
- resources>
-
- <plugins>
-
- <plugin>
- <groupId>org.apache.maven.pluginsgroupId>
- <artifactId>maven-compiler-pluginartifactId>
- <version>3.8.1version>
- <configuration>
- <compilerVersion>8 compilerVersion>
- configuration>
- plugin>
-
- <plugin>
- <groupId>org.apache.tomcat.mavengroupId>
- <artifactId>tomcat7-maven-pluginartifactId>
- <version>2.2version>
- <configuration>
-
- <path>/maven_01path>
- configuration>
- plugin>
-
- <plugin>
-
- <groupId>org.mybatis.generatorgroupId>
- <artifactId>mybatis-generator-maven-pluginartifactId>
- <version>1.3.7version>
- <dependencies>
- <dependency>
- <groupId>org.mybatis.generatorgroupId>
- <artifactId>mybatis-generator-coreartifactId>
- <version>1.3.7version>
- dependency>
- <dependency>
- <groupId>mysqlgroupId>
- <artifactId>mysql-connector-javaartifactId>
- <version>8.0.28version>
- dependency>
- dependencies>
- plugin>
-
- plugins>
- build>
-
-
- project>