Spring学习心得-初识Maven
什么是Maven
Maven项目对象模型(POM),可以通过一小段描述信息来管理项目的构建,报告和文档的项目管理工具软件。
Maven的创建(IDE用Idea为例)
File->New->project->maven 点击Next进入下一个界面 创建好之后的工程目录 Main目录(主目录)
Test目录(测试目录)
pom.xml的使用 一般pom.xml中配置的是种中央仓库的Jar包,我们要从中央仓库把我们的需要的Jar下载到本地 (maven中央仓库的地址:)
例如我们要从中央仓库把spring的核心文件下载下来 (就可以在原来pom.xml的后面加入):
<dependencies> <!-- https://mvnrepository.com/artifact/org.springframework/spring-context --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>5.1.5.RELEASE</version> </dependency> <!-- 更多的依赖 --> <dependency> ... </dependency> <dependencies>