最近做项目要用到Maven,故对Maven进行了学习,初次接触后,觉得其实和前端的npm很相似,都是项目管理工具,只不过一个用于前端,一个用于后台。下面将对我了解到的知识做一个整理,主要内容是Maven的简介和安装。
1、简介
官网:Apache Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project's build, reporting and documentation from a central piece of information.
翻译:Apache Maven是一个软件项目管理和理解工具。基于项目对象模型(POM)的概念,Maven可以利用一个中央信息片断(可理解为一小段描述信息)管理一个项目的构建、报告和文档。
2、什么是Maven?
官网:Maven, a Yiddish word meaning accumulator of knowledge, was originally started 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 and 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.
翻译:Maven这个单词来自于意第绪语,意为知识的积累,最早在Jakata Turbine项目中它开始被用来试图简化构建过程。当时有很多项目,它们的Ant构建文件仅有细微的差别,而JAR文件都由CVS来维护。于是Maven创始者想要一个更加标准的方式来构建项目,该项目的清晰定义包括:用一种简单方便的方式来发布项目信息,以及一种在多个项目中共享JAR的方式。
官网: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成为了一种被用于构建和管理任何基于Java项目的工具。Maven创始者希望能够更多的让Java开发人员的日常工作更加容易,帮助理解任何基于Java项目。
3、Maven的安装
3.1 下载安装
到官网下载安装包,下载的是一个解压包,解压到自己电脑上。这里我放在 E:\apache-maven-3.5.0
3.2 配置环境变量
打开系统的环境变量面板,选择 “环境变量” 中的 “新建” ,输入变量名和maven的安装路径,确认。然后在PATH变量后追加;%M2_HOME%/bin
3.3 测试
打开cmd命令提示符,输入mvn -v,显示如下,表示安装成功。