mvn -pl 有什么作用?
在此命令期间到底发生了什么:
mvn -pl ABC –am -amd?
它会编译代码吗?
我问的原因是我故意放置了一个无效文件,当我运行 mvn -pl ABC -am -amd 选项时,我得到了成功的结果,但我很困惑为什么 Maven 没有抱怨错误的文件?
但是如果我使用 mvn install
命令它会出错!
What exactly happens during this command:
mvn -pl ABC –am -amd?
Does it compile the code?
The reason I asked is I have purposely put an invalid file and when I run mvn -pl ABC -am -amd
option I get successful result and I'm confused why Maven is not complaining about the errored file?
But if I use mvn install
command it errors!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
-pl
或--projects
允许您选择一组特定的项目来应用您的目标(例如干净安装
),这样可以保存如果您只需要构建几个模块,那么您将花费时间等待大型项目的完整构建。您可能需要检查以下部分:
-pl
or--projects
allows you to select a specific set of projects to apply your goal, (e.g.clean install
) this way saving the time you would spend waiting for a full build on a big project if you just need to build a couple modules.You might wanna check the following section:
-pl
使 maven 仅构建指定的模块,而不是整个项目(在本例中它只是 ABC)。-am
使 Maven 找出我们的目标依赖哪些模块并构建它们(在本例中是 ABC 的依赖项)。-pl
makes maven build only specified modules and not the whole project (in this case it's only ABC).-am
makes maven figure out what modules our target depends on and build them too(in this case it's ABC's dependencies).如果你说 mvn -pl,并且没有给 -pl 任何参数,那么你就是在要求 maven 什么都不做。
-pl 假设您正处于一个具有多个模块的项目中,并且想要构建一个子集。您刚刚要求空子集。
If you say mvn -pl, and give no argument to -pl, you are asking maven to do absolutely nothing.
-pl assumes that you are sitting in a project with multiple modules, and want to build a subset. You just asked for the null subset.
你实际上并没有给它一个运行的目标。
mvn -pl Abc:Xyz -am -amd
有两个问题。首先,
-amd
隐含-am
,因此您不需要两者。其次,您没有给它一个运行目标,例如安装、打包、测试或编译。
You haven't actually given it a goal to run.
mvn -pl Abc:Xyz -am -amd
has two problems with it.First of all,
-amd
implies-am
, so you don't need both.Secondly, you haven't given it a goal to run, like install, package, test, or compile.