maven简介及使用help插件

什么是maven?

Maven是一个项目管理工具,它包含了一个项目对象模型 (Project Object Model),一组标准集合,一个项目生命周期(Project
Lifecycle),一个依赖管理系统(Dependency Management System),和用来运行定义在生命周期阶段(phase)中插件(plugin)目标(goal)的逻辑。 当你使用Maven的时候,你用一个明确定义的项目对象模型来描述你的项目,然后 Maven 可以应用横切的逻辑,
这些逻辑来自一组共享的(或者自定义的)插件。
 

获得Maven帮助
官方网站:https://maven.apache.org
Sonatype:https://www.sonatype.com

使用Maven Help插件
Maven Help 插件有四个目标。前三个目标是—— active-profiles, effective-pom 和
effective-settings —— 描述一个特定的项目,它们必须在项目的目录下运行。 最后
一个目标—— describe ——相对比较复杂,展示某个插件或者插件目标的相关信息。
help:active-profiles
列出当前构建中活动的Profile(项目的,用户的,全局的)。
help:effective-pom
显示当前构建的实际POM,包含活动的Profile。
help:effective-settings
打印出项目的实际settings, 包括从全局的settings和用户级别settings继承的
配置。
help:describe
描述插件的属性。它不需要在项目目录下运行。但是你必须提供你想要描述插件
的 groupId 和 artifactId。
 

描述一个Maven插件
 

$ 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坐标,目标前缀,和该插件的一个简要介绍。尽管这些信息非常有帮助,你通常还是需要了解更多安装和运行Maven的详情。如果你想要 Help 插件输出完整的带有参数的目标列表,只要运行带有参数full 的 help:describe 目标就可以了,像这样:

$ mvn help:describe -Dplugin=help -Dfull
...
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.
Mojos:
===============================================
Goal: 'active-profiles'
===============================================
Description:
Lists the profiles which are currently active for this build.
Implementation: org.apache.maven.plugins.help.ActiveProfilesMojo
Language: java
Parameters:
-----------------------------------------------
[0] Name: output
Type: java.io.File
Required: false
Directly editable: true
Description:
This is an optional parameter for a file destination for the o
listing of active profiles per project.
-----------------------------------------------
[1] Name: projects
Type: java.util.List
Required: true
Directly editable: false
Description:
This is the list of projects currently slated to be built by Maven.
-----------------------------------------------
This mojo doesn't have any component requirements.
===============================================
... removed the other goals ...

该选项能让你查看插件所有的目标及相关参数。但是有时候这些信息显得太多了。这
时候你可以获取单个目标的信息,设置 mojo 参数和 plugin 参数。下面的命令列出了
Compiler 插件的 compile 目标的所有信息
 

$ mvn help:describe -Dplugin=compiler -Dmojo=compile -Dfull

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值