1.maven 是开发者在开发项目时用来管理jar包的工具。
2.maven的相关知识
(1)maven的本地资源库,一般默认在本地计算机的.m2文件中。
(2)在一个项目中,maven会先检查项目中的pom文件,以确定哪些文件是需要依赖下载的。首先会从本地的.m2文件下的资源库中下载,如果没有找到没到,会到中央资源库中国寻找,然后进行下载,maven的中央资源库地址为 http://repo1.maven.org/maven2/。
(3)maven远程资源库
在一个项目中,如果在本地资源库或者中央资源库都为找到资源,则会到远程资源库中下载文件。但是该资源库只适用于java.net资源库。
<dependency> <groupId>org.jvnet.localizer</groupId> <artifactId>localizer</artifactId> <version>1.8</version> </dependency>
(4).maven中的<dependency>的三个子节点都是必填字段
(5)如果存在父模块,则需要添加
<parent>
<groupId>com.hanshows.esl</groupId>
<artifactId>shopweb</artifactId>
<version>1.7.0-rc3</version>
</parent>
如
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.9</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
则在子模块中不需要在写版本号<version>
如
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
- </dependencies>