在所有子模块中从命令行执行目标
这是来自多模块父 pom 的片段。如何在项目的所有子模块中运行目标?
<modules>
<module>../utp</module>
<module>../testdependency</module>
</modules>
当我尝试通过 mvn -am -pl utp help:evaluate -Dexpression=project.artifactId 运行此目标时,我只会获得父 pom 的结果,而不会获得任何结果对于 utp 和最终的依赖项。
如何在项目的所有子模块上运行目标?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据 文档,我们可以使用
help:评估
评估一些 Maven 表达式。这以交互方式工作,或者以
artifact
和expression
作为参数。如果在项目 pom 上运行,它会报告项目的结果;如果在没有 pom 的情况下运行,它会报告artifact
。它并不意味着提供所有依赖项的工件详细信息。
不确定您的要求是什么...如果是要获取各种依赖项详细信息,您可以尝试 maven 依赖插件,例如
mvn dependency:list
或mvn dependency:tree
。如果要知道依赖项的版本是否是最新的,您可以尝试 versions 中的目标maven 插件,例如mvn display-dependency-updates
。编辑:
在>中定义的插件parent pom 的部分仅在声明这些
的模块中运行。在其他模块中,它们不运行。也许 mvn help: effective-pom 可以提供一些信息。As per the documentation, we could use
help:evaluate
to evaluate some Maven expressions.This works in an interactive way or takes
artifact
andexpression
as parameter. It reports the result for the project if run on the project pom or theartifact
if run without a pom.It is not meant to give the artifact details for all dependencies.
Not sure what your requirement is... If it is to get the various dependency details, you could try one of the goals of maven dependency plugin, like
mvn dependency:list
ormvn dependency:tree
. If it is to know if the versions of the dependencies are upto date, you could try a goal in versions maven plugin likemvn display-dependency-updates
.Edit:
Plugins which are defined in
<pluginManagement
> section of parent pom are run only in those modules, where these<plugins>
are declared. In other modules, they are not run. Perhaps mvn help:effective-pom can give some info.