前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >maven 中的 goal 是什么

maven 中的 goal 是什么

作者头像
水货程序员
发布2018-11-13 16:47:03
18.4K0
发布2018-11-13 16:47:03
举报
文章被收录于专栏:javathingsjavathings

maven 中的 goal 是什么

maven 中包含三个生命周期,参考 《Maven 生命周期(需了解)》

每个生命周期包含了多个步骤(phase),而 goal 则是绑定到 phase 上的,每一个 phase 都对应 1 个或多个 goal。

goal 是存在于 maven plugin 中,因此,大多数的 maven 功能实际上是存在于插件中,一个 maven 插件提供了一组可以被运行的 goal。

之间的如下 所示:

maven 中可以通过下面的命令格式运行 goal:

mvn [plugin-name]:[goal-name]

比如:

mvn compiler:compile,运行 compiler 插件中的 compile goal。

事实上 compiler:compile.,正是对应于 compile phase 的,即运行 compile phase 就等于运行了 mvn compiler:compile.

在 eclipse 中可以配置运行 maven 中指定的 goal。

phase 和 goal 的不同在于:

运行某个 phase 的时,必须把生命周期中的所有的前置 phase 都会运行一遍。

而运行 goal,可以脱离生命周期这个概念,通过 maven 插件,单独的运行某个 goal 或一组 goal。

参考:

http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html

https://stackoverflow.com/questions/16205778/what-are-maven-goals-and-phases-and-what-is-their-difference

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • maven 中的 goal 是什么
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档