使用Maven之前,一直都是自己手工在网上搜索需要的jar包,然后添加到工程中。这条命令,要安装的包为hello.jar,我们假定该包的groupId是com.noname,artifactId是hello,版本是8.8.8。
即便是所要依赖的工程依赖了其它工程,我们也只需引入项目所直接的依赖的工程。如下图示例中 Dependency-A 引用了 Dependency-B ,而 Dependency-B 又依赖于 Dependency-C ,在传统项目中若在 Dependency-A 中引用 Dependency-B 则需要同时手动添加 Dependency-B 与 Dependency-C 所对应的 JAR 包,但在 Maven 中我们只需要引入 Dependency-B 即可, Mavne 会自动将子模块所依赖的包导入。
Maven的作用在开发过程中需要用到各种各样的jar包,查找和下载这些jar包是件费时费力的事,特别是英文官方网站,可以将Maven看成一个整合了所有开源jar包的合集,我们需要jar包只需要从Maven里面下载就可以了,使用主流的IDE开发项目主要用Maven的pom.
If you have several Maven projects, and they all have similar configurations, you can refactor your projects by pulling out those similar configurations and making a parent project. Thus, all you have to do is to let your Maven projects inherit that parent project, and those configurations would then be applied to all of them.
Maven大家都很熟悉,但是我们很多人,对它其实都是似乎很熟,但是又好像不熟悉的感觉,包括我,今天咱们就一起来彻底了解Maven的所有功能,我们从入门,到原理剖析,再到实践操作,最后是私服的搭建以及配置,整体并彻底了解一下Maven。