javawebDay4-Maven框架
- 设置环境变量
从官网中下载最新的maven压缩包
https://maven.apache.org/download.cgi
解压,将路径保存至电脑中的环境变量
*配置镜像仓库(阿里云)
将如下代码粘贴至选中位置
<mirror>
<id>allmaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
<mirrorOf>central</mirrorOf>
</mirror>
*更改访问目录
*集成IDEA
创建你的第一个Maven项目吧!
*添加依赖
在xml文件中可以添加你想要的jar包,这里以添加junit测试包和framework包为例
在官方文档可以找到相应的jar包,添加后记得刷新一下
<dependencies>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-context -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>6.1.6</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.9.1</version>
</dependency>
</dependencies>
*断言
添加junit包后就可以测试自己的代码了,这里以测试自建的用户类为例,对性别测试