1. Introduction(简介)

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是一个意第绪语,意思是“知识累加器”,最初是为了简化Jakarta Turbine项目的构建过程。有几个项目每个都有自己的Ant构建文件,这些文件仅略有不同,但是jar都被导入CVS。我们想要一种标准的方法来构建项目,明确定义项目的内容,一种发布项目信息的简单方法,以及在多个项目中共享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.

我们最终得到的是一个可以用于构建和管理任何基于java项目的工具。希望我们创造的东西能使Java开发人员的日常工作变得更容易,并且有助于理解任何基于Java的项目。

2. Maven’s Objectives(目标)

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 there are several areas of concern that Maven attempts to deal with:

  • Making the build process easy
  • Providing a uniform build system
  • Providing quality project information
  • Providing guidelines for best practices development
  • Allowing transparent migration to new features

Maven的主要目标是让开发人员在最短的时间内理解开发工作的全部状态。为了实现这一目标,Maven试图解决以下几个方面的问题:

  • 使构建过程变得容易
  • 提供统一的构建系统
  • 提供高质量的项目信息
  • 为最佳实践开发提供指导方针
  • 允许透明迁移到新特性

Making the build process easy(使构建过程变得容易)

While using Maven doesn’t eliminate the need to know about the underlying mechanisms, Maven does provide a lot of shielding from the details.

虽然使用Maven并不能完全消除对底层机制的了解,但Maven确实屏蔽了大量细节。

Providing a uniform build system(提供统一的构建系统)

Maven allows a project to build using its project object model (POM) and a set of plugins that are shared by all projects using Maven, providing a uniform build system. Once you familiarize yourself with how one Maven project builds you automatically know how all Maven projects build saving you immense amounts of time when trying to navigate many projects.

Maven允许一个项目使用其项目对象模型(POM)和一组插件来构建,这些插件由使用Maven的所有项目共享,提供了一个统一的构建系统。一旦您熟悉了一个Maven项目是如何构建的,您就会自动地知道所有Maven项目是如何构建的,在您浏览许多项目时将节省大量的时间。

Providing quality project information(提供高质量的项目信息)

Maven provides plenty of useful project information that is in part taken from your POM and in part generated from your project’s sources.
For example, Maven can provide:

  • Change log document created directly from source control
  • Cross referenced sources
  • Mailing lists
  • Dependency list
  • Unit test reports including coverage

Maven提供了大量有用的项目信息,这些信息部分来自您的POM,部分来自于您的项目的源代码。
例如,Maven可以提供:

  • 从源代码控制直接创建的变更日志文档
  • 交叉引用的来源
  • 邮件列表
  • 依赖项列表
  • 包含覆盖的单元测试报告

As Maven improves the information set provided will improve, all of which will be transparent to users of Maven.

随着Maven改进所提供的信息集将得到改进,所有这些都将对Maven的用户透明。

Other products can also provide Maven plugins to allow their set of project information alongside some of the standard information given by Maven, all still based on the POM.

其他产品也提供Maven插件,让这些项目信息与Maven给出的一些标准信息一起使用,这一切都基于POM。

Providing guidelines for best practices development(为最佳实践开发提供指导方针)

Maven aims to gather current principles for best practices development, and make it easy to guide a project in that direction.
For example, specification, execution, and reporting of unit tests are part of the normal build cycle using Maven. Current unit testing best practices were used as guidelines:

  • Keeping your test source code in a separate, but parallel source tree
  • Using test case naming conventions to locate and execute tests
  • Have test cases setup their environment and don’t rely on customizing the build for test preparation.

Maven also aims to assist in project workflow such as release and issue management.

Maven also suggests some guidelines on how to layout your project’s directory structure so that once you learn the layout you can easily navigate any other project that uses Maven and the same defaults.

Maven的目标是收集当前最佳实践开发的原则,并指导项目朝着这个方向发展。
例如,单元测试的规范、执行和报告是使用Maven的正常构建周期的一部分。目前的单元测试最佳实践被用作指导方针:

  • 将你的测试源代码保存在一个单独且并行的树中
  • 使用测试用例命名约定来定位和执行测试
  • 让测试用例设置它们的环境,不要依赖于为测试准备的定制构建。

Allowing transparent migration to new features(允许透明迁移到新特性)

Maven provides an easy way for Maven clients to update their installations so that they can take advantage of any changes that been made to Maven itself.

Installation of new or updated plugins from third parties or Maven itself has been made trivial for this reason.

Maven为客户提供了一种简单的方法来更新安装,这样就可以利用对Maven本身进行的任何更改。

出于这个原因,插件来自于第三方还是来自于Maven本身安装新,已经变得不重要了。

3. What is Maven Not?(Maven是什么)

You may have heard some of the following things about Maven:

  • Maven is a site and documentation tool
  • Maven extends Ant to let you download dependencies
  • Maven is a set of reusable Ant scriptlets

对于maven,也许你听说过以下说法:

  • Maven是一个站点和文档工具
  • Maven扩展Ant,让您下载依赖项
  • Maven是一组可重用的Ant scriptlet

While Maven does these things, as you can read above in the “What is Maven?” section, these are not the only features Maven has, and its objectives are quite different.

Maven does encourage best practices, but we realise that some projects may not fit with these ideals for historical reasons. While Maven is designed to be flexible, to an extent, in these situations and to the needs of different projects, it can not cater to every situation without making compromises to the integrity of its objectives.

当Maven做这些事情的时候,您可以在上面读到"什么是Maven?",但这些并不是Maven唯一的特性,它的目标与此是完全不同的。
Maven鼓励最佳实践,但我们意识到,出于历史原因,有些项目可能与这些想法不符。虽然Maven的设计是灵活的,但在不同项目的需求中,如果不对目标的完整性做出妥协,是不能适用于每一种场景的。

If you decide to use Maven, and have an unusual build structure that you cannot reorganise, you may have to forget some features or the use of Maven altogether.

如果您决定使用Maven,并且有一个不能重新组织的构建结构,那么您可能不得不忘记一些特性或Maven的使用。

更多推荐

Maven介绍(翻译自官方文档)