1.解压压缩包
apache-maven-3.6.0-bin.zip
2.配置环境地址
3.验证环境配置是否正确
cmd
输入mvn -version
4.创建空文件夹mavenrepository(maven 仓库)
5.对解压后的文件中settings.xml(在conf文件夹中)进行配置
添加阿里云镜像服务器
6.初次使用idea设置maven
File ->New Projects Settings ->Settings For New Project
7 .创建maven 工程
8.Pom.xml配置
在
中添加配置信息
<dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.1.0</version> <scope>provided</scope> </dependency> <!-- 配置servler开发环境-->
groupId 组件id(路径)
artifactID 构建id(组件名称)
version 版本信息
type 包类型,默认是jar
scope compile 默认的,打包会将此jar包打包到项目的lib目录中
provided 只在编译时使用,打包时不会被打包到war包中
9.mvn命令使用
compile 编译
clean 删除target
package 打包
install 把项目install到本地仓库
test 运行测试代码