klingon

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

Learning Maven

Install Maven

需要设置PATH和M2_M2_HOME两个环境变量,Maven安装完成后,命令行运行 mvn -v检查一下它是否装好

C:\Users\Klingon>mvn -v
Apache Maven 2.2.1 (r801777; 2009-08-07 03:16:01+0800)
Java version: 1.6.0_27
Java home: D:\Program Files\Java\jdk1.6.0_27\jre
Default locale: zh_CN, platform encoding: GBK
OS name: "windows 7" version: "6.1" arch: "x86" Family: "windows"
C:\Users\Klingon>

Use Maven

一旦你开始使用Maven,你会花很多时间去试图获得Maven插件的信息:插件如何工作?配置参数是什么?目标是什么? 你会经常使用help:describe 目标来获取这些信息。通过 plugin 参数你可以指定你想要研究哪个插件,你可以传入插件的前缀(如 help 插件就是 maven-help-plugin),或者可以是 groupId:artifact[:version] ,这里 version 是可选的。比如, 下面的命令使用 help 插件的 describe 目标来输出 Maven Help 插件的信息。

$ mvn help:describe -Dplugin=help

...

Group Id: org.apache.maven.plugins

Artifact Id: maven-help-plugin

Version: 2.0.1

Goal Prefix: help

Description:

 

The Maven Help plugin provides goals aimed at helping to make sense out of

the build environment. It includes the ability to view the effective

POM and settings files, after inheritance and active profiles

have been applied, as well as a describe a particular plugin goal to give

usage information.

...

通过设置 plugin 参数来运行 describe 目标,输出为该插件的Maven坐标,目标前缀,和该插件的一个简要介绍。尽管这些信息非常有帮助,你通常还是需要了解更多的详情。如果你想要 Help 插件输出完整的带有参数的目标列表,只要运行带有参数 full 的 help:describe 目标就可以了,像这样:

$ mvn help:describe -Dplugin=help -Dfull

The Eclipse Plugins of  Maven

Eclipse plugins for Maven

The following plugins allow using Maven from the Eclipse IDE, avoiding the use of the Maven command line interface. They integrate Maven in the IDE in different ways, please check their sites for more information. Both plugins allow running Maven goals from Eclipse, see the output in a view inside the IDE and synchronize Maven POM information with Eclipse project information to some extent.

The Maven Integration for Eclipse (m2eclipse, Eclipse m2e)

The Maven Integration for Eclipse is the first and most mature of the projects aimed at integrating Maven within the Eclipse IDE. It is released under the EPL 1.0 license.

Features include:

  • Launching Maven builds from within Eclipse
  • Dependency management for Eclipse build path based on Maven's pom.xml
  • Resolving Maven dependencies from the Eclipse workspace without installing to local Maven repository
  • Automatic downloading of the required dependencies and sources from the remote Maven repositories
  • Wizards for creating new Maven projects, pom.xml and to enable Maven support on existing projects
  • Quick search for dependencies in remote Maven repositories
  • Quick fixes in the Java editor for looking up required dependencies/jars by the class or package name
  • Integration with other Eclipse tools, such as WTP, AJDT, Mylyn, Subclipse and others.

Eclipse Integration for Apache Maven (Eclipse IAM), formerly Q for Eclipse

Eclipse IAM is a newer Apache Maven plugin for Eclipse with a fresh approach for Maven integration with the Eclipse IDE and other Eclipse plugins (JDT, WTP, Candy for Appfuse,...), also opening the doors for other Eclipse plugin developers to access Maven features as easy as possible.

With five releases already, and continuing to make one every other month it's quickly maturing.

Check the FAQ and Installation instructions

You can join the newsgroup at

  • server: news.eclipse.org
  • group: eclipse.technology.iam
  • or at the web interface
posted on 2011-11-13 19:08  klingon  阅读(287)  评论(0)    收藏  举报