maven 学习笔记(一)maven 的安装

引言

学习maven有以下两个问题?
1、首先需要知道什么是maven?
2、如何安装maven?

什么是maven?

我们打开maven 官网,以下是maven给出的定义。
Maven, a Yiddish word meaning accumulator of knowledge, began as an attempt to simplify the build processes in the Jakarta Turbine project. There were several projects, each with their own Ant build files, that were all slightly different. JARs were checked into CVS. We wanted a standard way to build the projects, a clear definition of what the project consisted of, an easy way to publish project information, and a way to share JARs across several projects.

The result is a tool that can now be used for building and managing any Java-based project. We hope that we have created something that will make the day-to-day work of Java developers easier and generally help with the comprehension of any Java-based project.

maven 能帮我们做什么

Maven’s primary goal is to allow a developer to comprehend the complete state of a development effort in the shortest period of time. In order to attain this goal, Maven deals with several areas of concern:
Making the build process easy
Providing a uniform build system
Providing quality project information
Encouraging better development practices
总结起就是两个方面
1、一键构建
2、依赖管理

maven 下载

打开官网找到下载
在这里插入图片描述
小猿就在此处下载最新版本了,直接点击下载下来即可。如果想看源码,则直接下载源码查看即可。

如何安装maven

Maven 下载后,将 Maven 解压到一个没有中文没有空格的路径下,比如 D:\Developjava下面。
解压后目录结构如下:
在这里插入图片描述
目录结构
bin:存放了 maven 的命令,比如我们前面用到的 mvn tomcat:run
boot:存放了一些 maven 本身的引导程序,如类加载器等
conf:存放了 maven 的一些配置文件,如 setting.xml 文件
lib:存放了 maven 本身运行所需的一些 jar 包
至此小猿的 maven 软件就可以使用了,前提是你的电脑上之前已经安装并配置好了 JDK。
配置maven环境变量,小猿的环境变量配置如下:
在这里插入图片描述
在这里插入图片描述
notes:一定要确保jdk环境已经成功配置,若不懂jdk如何安装的童鞋可以参考小猿的博客。
测试maven
通过 mvn -v命令检查 maven 是否安装成功,看到 maven 的版本为 3.5.2 及 java 版本为 1.8 即为安装
成功。
找开 cmd 命令,输入 mvn –v命令, 如下图:
在这里插入图片描述
至此,maven安装成功了,若小伙伴们想看maven如何使用,请看小猿的博客maven学习笔记之(二)maven 的使用。

猜你喜欢

转载自blog.csdn.net/xueshanfeitian/article/details/108661401