项目构建工具 Apache Maven 3.0.4 发布
fmms 13年前
<p><img title="Maven logo" alt="项目构建工具 Apache Maven 3.0.4 发布" src="https://simg.open-open.com/show/df3476a861481e0333ebd0415cb5b54a.gif" width="90" height="28" /><br /> 目前,绝大多数开发人员都把 Ant 当作 Java 编程项目的标准构建工具。遗憾的是,Ant 的项目管理工具(作为 <code>make</code> 的替代工具)不能满足绝大多数开发人员的需要。通过检查 Ant 构建文件,很难发现项目的相关性信息和其它元信息(如开发人员/拥有者、版本或站点主页)。</p> <p>Maven 除了以程序构建能力为特色之外,还提供 Ant 所缺少的高级项目管理工具。由于 Maven 的缺省构建规则有较高的可重用性,所以常常用两三行 Maven 构建脚本就可以构建简单的项目,而使用 Ant 则需要十几行。事实上,由于 Maven 的面向项目的方法,许多 Apache Jakarta 项目现在使用 Maven,而且公司项目采用 Maven 的比例在持续增长。</p> <p>Maven vs Ant</p> <p>那么,Maven 和 Ant 有什么不同呢?在回答这个问题以前,我要强调一点:Maven 和 Ant 针对构建问题的两个不同方面。Ant 为 Java 技术开发项目提供跨平台构建任务。Maven 本身描述项目的高级方面,它从 Ant 借用了绝大多数构建任务。因此,由于 Maven 和 Ant 代表两个差异很大的工具,所以我将只说明这两个工具的等同组件之间的区别,如表 1 所示。</p> <p>表 1. Maven vs Ant</p> <table border="1" cellspacing="0" cellpadding="3"> <tbody> <tr> <td> </td> <td><strong>Maven</strong></td> <td><strong>Ant</strong></td> </tr> <tr> <td>标准构建文件</td> <td>project.xml 和 maven.xml</td> <td>build.xml</td> </tr> <tr> <td>特性处理顺序</td> <td> <ol> <li>${maven.home}/bin/driver.properties </li> <li>${project.home}/project.properties </li> <li>${project.home}/build.properties </li> <li>${user.home}/build.properties </li> <li>通过 -D 命令行选项定义的系统特性 </li> </ol> <strong>最后一个</strong>定义起决定作用。</td> <td> <ol> <li>通过 -D 命令行选项定义的系统特性 </li> <li>由 任务装入的特性 </li> </ol> <strong>第一个</strong>定义最先被处理。</td> </tr> <tr> <td>构建规则</td> <td>构建规则更为动态(类似于编程语言);它们是基于 Jelly 的可执行 XML。</td> <td>构建规则或多或少是静态的,除非使用 <code> <!-- </code> 任务。(请参阅 <a href="http://www.ibm.com/developerworks/cn/java/j-maven/#resources" _mce_href="http://www.ibm.com/developerworks/cn/java/j-maven/#resources" mce_href="http://www.ibm.com/developerworks/cn/java/j-maven/#resources">参考资料</a>以获得相关教程。)</td> </tr> <tr> <td>扩展语言</td> <td>插件是用 Jelly(XML)编写的。</td> <td>插件是用 Java 语言编写的。</td> </tr> <tr> <td>构建规则可扩展性</td> <td>通过定义 <code> <pregoal></code> 和 <code> <postgoal></code> 使构建 goal 可扩展。</td> <td>构建规则不易扩展;可通过使用 <code> <script></code> 任务模拟 <code> <pregoal></code> 和 <code> <postgoal></code> 所起的作用。</td> </tr> </tbody> </table> // --></code></td> </tr> </tbody> </table> <p>相关开发环境下的Maven插件:<a href="/misc/goto?guid=4958326407874360287" target="_blank">http://mevenide.codehaus.org/</a></p> <div> <p>项目地址:<a href="/misc/goto?guid=4958326408677261325">http://maven.apache.org/</a><br /> ** Bug<br /> * [MNG-4792] - Preemptive authentication doesn't work<br /> * [MNG-5064] - mvn -nsu (--no-snapshot-updates) should not download snapshots (and break local builds)<br /> * [MNG-5096] - <exclusion> on <dependency> with <type> test-jar </type> doesn't work in maven 3 <br /> * [MNG-5113] - NullPointerException on javadoc site generation <br /> * [MNG-5131] - Wrong encoding for encrypted passwords <br /> * [MNG-5135] - Regression: in some cases aggregator mojo is unable to resolve dependencies with custom packaging <br /> * [MNG-5137] - Reactor resolution does not work for forked multi module builds <br /> * [MNG-5149] - DefaultArtifactRepositoryFactory.createArtifactRepository overload w/layoutId passes wrong (repo) id <br /> * [MNG-5153] - ModelMerger omits relativ path <br /> * [MNG-5155] - 'inherited' flag of report sets ignored. <br /> * [MNG-5157] - NPE stemming from DefaultModelBuilder.containsCoordinates <br /> * [MNG-5163] - MavenProject.getPluginRepositories misimplemented <br /> * [MNG-5164] - Odd <name> of central in superpom <br /> * [MNG-5165] - Problem with scp transport (wagon-maven-plugin 1.0-beta-3, Maven 2.2.1, Ubuntu 11.04) <br /> * [MNG-5192] - prevent ConcurrentModificationException in parallel mode -Tx when project have errors <br /> * [MNG-5221] - Default version of m-site-p does not work (no reports) <br /> * [MNG-5224] - REGRESSION: Injected Settings in a Mojo are missing the profiles from settings.xml <br /> * [MNG-5225] - The default version of the maven-site-plugin as defined in the site-lifecycle must be 3.x <br /> <br /> ** Improvement <br /> * [MNG-4112] - Set property containing the currently executing maven version. <br /> * [MNG-5073] - ProjectBuilder.build(File,ProjectBuildingRequest) returns null project if dependency version info is missing <br /> * [MNG-5076] - Improve SEO of documentation of lifecycle.xml <br /> * [MNG-5119] - improve site organization of core components <br /> * [MNG-5134] - Standard documentation for build-in properties <br /> * [MNG-5141] - Make MojoExecutor.ensureDependenciesAreResolved public <br /> * [MNG-5151] - use CNAME or repo to provide more stability <br /> * [MNG-5152] - upgrade wagon to the final 1.0 version <br /> * [MNG-5158] - Make loading of extensions from lib/ext more robust with regard to existence of ext directory <br /> * [MNG-5159] - Extend validation of settings.xml to check for uniqueness of id elements <br /> * [MNG-5175] - replace wagon http lightweight with wagon http 2.1 <br /> * [MNG-5200] - upgrade plugin versions in super pom <br /> * [MNG-5201] - upgrade aether to 1.13.1 and sisu to 2.3.0 <br /> <br /> ** Task <br /> * [MNG-5046] - Remove $Id$ from sources <br /> <br /> ** Test <br /> * [MNG-5114] - Handling unrecognized version qualifiers <br /> <br /> ** Wish <br /> * [MNG-5118] - add aggregated javadoc </name> </dependency> </exclusion></p> </div>