`

Maven 介绍(What is Maven?)

阅读更多

 

Maven介绍<o:p></o:p>

       Maven这个词在犹太语中的意思是学问渊博的人”(accumulator of knowledge ),它开始于Jakarta Turbine这个项目中想要简化对项目管理的尝试。因为在这个项目中有很多的子项目,在每个子项目中都有各自的Ant脚本文件(build.xml 其实这些文件都大同小异),而且每个项目中都有许多依赖的jar文件,而作为项目的一部分,这些东西又都不得不提交到CVS中进行统一的管理。于是就有人思考:有没有一个标准的方式来构建这个项目呢,并且可以清晰的定义出这个项目是如何组织的、可以很容易的就发布出项目的信息,而且可以很方便的共享这些项目中公用的那些jar文件?<o:p></o:p>

        问题的答案就是,一个新工具的诞生--Maven,它可以用来构建和管理任何基于Java的项目。它做了很多的事情,而这些事情可以简化很多开发者的日常工作,并且有助于理解其他的那些基于Java的项目。<o:p></o:p>

Maven的目标<o:p></o:p>

        Maven的主要目标是让开发人员可以在最短的时间内了解一个开发出来的东西的全部状态。为了达到这个目的,Maven尝试去解决以下这几个方面的问题:<o:p></o:p>

  • 使项目构建过程变得更加简单 <o:p></o:p>
  • 提供一种统一的构建系统 <o:p></o:p>
  • 提供高质量的项目信息 <o:p></o:p>
  • 提供一些开发方面的最佳实践 <o:p></o:p>
  • 可以一种透明的方式移植到新特性上 <o:p></o:p>

下面来分别进行叙述:<o:p></o:p>

使项目的构建过程变得更加简单 <o:p></o:p>

        在使用Maven的时候,不要抛开具体的需求而想要去了解Maven内部的工作机制(大部分开发人员都喜欢去探究一个事物的内部工作原理,呵呵~)Maven屏蔽了许多细节部分。<o:p></o:p>

提供一种统一的构建系统<o:p></o:p>

         Maven提供了足够多的有用的项目信息,一部分来自于POM,另一部分来自于你的项目中的源码。例如,Maven可以提供以下信息:<o:p></o:p>

  • 可以直接从版本管理系统(例如:CVSSVN等)中创建出更改日志 <o:p></o:p>
  • 参照源列表(Cross referenced sources) <o:p></o:p>
  • 邮件列表(Mailing lists) <o:p></o:p>
  • 依赖列表(Dependency list) <o:p></o:p>
  • 单元测试报告及测试覆盖率 <o:p></o:p>

        Maven发生变化的时候,所提供的信息集合也将随之发生相应的变化,所有这些对于Maven的用户来说都是透明的。<o:p></o:p>

        另外,其他产品也可以提供一些Maven的插件来使它们的项目信息能够和Maven提供的项目信息一起显示,所有的这样也都一样是基于POM的。<o:p></o:p>

 提供一些开发方面的最佳实践<o:p></o:p>

         Maven致力于搜集一些当前在开发方面的最佳实践原则,并且可以很容易的指导一个项目往这个方向上发展。例如,规格说明(specification)execution和单元测试报告(reporting of unit tests)是使用Maven进行项目构建的正常步骤。现在的单元测试最佳实践采用以下的一些指导方针:<o:p></o:p>

  • 把你的测试源代码放在一个单独的,但是平行的代码树中 <o:p></o:p>
  • 使用测试用例命名规则来定位和执行测试 <o:p></o:p>
  • 不要去人为的定义测试的初始化环境,让测试用例自己来装载他们的测试环境 <o:p></o:p>

        Maven也在项目的工作流程上提供了一些帮助,比如发布管理和一些版本跟踪信息。<o:p></o:p>

        Maven在项目目录结构的布局上也提出了一些自己的建议,所以一旦你掌握了Maven的基本目录结构,那么就可以很轻松的在其他一些也使用了Maven来管理项目,并且使用了默认约定的项目中进行操作,说白了可以让你很快的看清项目的一个概况。<o:p></o:p>

可以一种透明的方式移植到新特性上<o:p></o:p>

        对于Maven客户端来说,Maven提供一种简单的方式来更新已安装的程序,所以可以很轻松的使用Maven本身所做的任何更改。从这个角度来说安装一个其自身的新的插件或者更新一个第三方的插件所付出的代价,对于Maven来说已经可以忽略不计了^_^<o:p></o:p>

说了这么多了,那么下面我想说说,大家对Maven误解<o:p></o:p>

  • Maven是一个生成站点和文档的工具 <o:p></o:p>
  • Maven扩展了Ant,可以使你下载依赖 <o:p></o:p>
  • Maven是一组可重用的Ant脚本 <o:p></o:p>

        Maven可以做这些事情,从上面的介绍中我们就可以知道,但是这些并不是Maven的全部特征,Maven的目标远不止这些。<o:p></o:p>

        Maven鼓励最佳实践,但是我们同样看到,有些项目由于历史原因可能并不适合使用这些好的方法。Maven被设计成为具有可伸缩性和可扩展性,那么在这些情况下,对于项目的需求来说,只需要做一些折衷处理就可以达到目的了。<o:p></o:p>

        如果你打算使用Maven,但是又有一些不同寻常的目录结构,且这些结构是你不能够重新进行组织的,那么你可能就需要放弃一些Maven的特性或者使用方法了。<o:p></o:p>

原文地址:http://maven.apache.org/what-is-maven.html <o:p></o:p>

分享到:
评论

相关推荐

    apache-maven-3.3.9.rar

    What is it? ----------- 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 ...

    maven definitive guide

    What is the difference? A build tool such as Ant is solely focused on preprocessing, compilation, packaging, testing, and distribution. A project management tool such as Maven provides a superset of ...

    Maven.Essentials.178398676

    Maven Essentials is a fast-paced guide to show you the key concepts in Maven and build automation. We get started by introducing you to Maven and exploring its core concepts and architecture. Next, ...

    apache-maven-3.5.0-bin

    What is it? ----------- 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 ...

    apach-maven-3.6.0

    If you think that Maven could help your project, you can find out more information in the "About Maven" section of the navigation: this includes an in-depth description of what Maven is and a list of ...

    Mastering.Apache.Maven.3

    Maven is the number one build tool used by developers for more than a decade. Maven stands out among other build tools due to its extremely extensible architecture, which is built on top of the ...

    Apache.Maven.Cookbook.1785286129

    Apache Maven Cookbook is for those who want to learn how Apache Maven can be used for build automation. It is also meant for those familiar with Apache Maven, but want to understand the finer nuances ...

    Maven权威指南 很精典的学习教程,比ANT更好用

    1. 介绍 Apache Maven 1.1. Maven... 它是什么? 1.2. 约定优于配置(Convention Over Configuration) 1.3. 一个一般的接口 1.4. 基于Maven插件的全局性重用 1.5. 一个“项目”的概念模型 1.6. Maven是Ant的...

    apache-maven-3.2.1

    What is it? ----------- 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 ...

    Apache Maven Dependency Management

    If you are working with Java or Java EE projects and you want to take advantage of Maven dependency management, then this book is ideal for you. This book is also particularly useful if you are a ...

    what-is-maven:日本语でのMaven入门

    “ Maven3のはじめかた”はMaven {{book.version.maven}}に対応したMavenの入门ならびに応用を助ける日本语资料(开発中)です。GitHubにて。こちらのQRコードからも无偿配布ページに行けます。 ライセンスならびに...

    Android代码-RxAssetManager

    What is RXASSETMANAGER? An RxJava2 implementation of the Android AssetManager. Any help or contribution is welcome. How do you GET it? Use the jcenter() or mavenCentral() repository. repositories { ...

    Social.Engineering.1523850930.epub

    Chapter 1: What is Social Engineering? Chapter 2: Social Engineering – Basic Psychological Tactics Chapter 3: Social Engineering Tools Chapter 4: Pickup Lines of Social Engineers Chapter 5: Social ...

    Android代码-FeedbackManager

    What is it / What does it do? This is a very small library that allows you to send feedback from an app without internet connection via email, either directly or via an unintrusive notification. It ...

    Android代码-CacheFileProvider

    What is it / What does it do? This is a minimal library with a few lines of code and without dependencies that offers a simple cache file provider (simple read only access for sharing files with other...

    Android代码-modrun

    In Maven context a "module" is an artifact in a specific version. When running an application with ModRun you just point to the Maven repository containing the artifact you want to run, then tell ...

    Android代码-实现类似锤子和 Google Photo 的滑动选择功能。

    What is it / What does it do? It's a simple one class TouchListener that can be attached to any RecyclerView and handles multi selection in google photos style via long pressing on an item and moving ...

    android-async-http 源码

    See what is new in version 1.4.9 released on 19th September 2015 https://github.com/loopj/android-async-http/blob/1.4.9/CHANGELOG.md Javadoc Latest Javadoc for 1.4.9 release are available here ...

    Struts2.3.16.3 chm帮助文档

    Apache Struts 2 is an elegant, extensible framework for...The contents of the Struts 2 documentation wiki (what you're reading now) are distributed with each release, but maintained via the on-line wiki.

    hibernate-shards.jar

    that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a ...

Global site tag (gtag.js) - Google Analytics