定义将在Maven多项目构建中构建的模块列表 [英] Define modules list which shall be build in Maven multiproject build
问题描述
我想使用Maven -pl选项定义哪些特定模块应包含在反应堆中.如果提供了模块路径列表,则该选项有效.不幸的是,提供模块的artifactIds根本不起作用. Sonatype"Maven:完整参考"文档正在使用多项目示例,其中目录名称与artifactIds匹配:
I would like to use Maven -pl option to define which specific modules shall be included into reactor. The option works if list of module's paths is provided. Unfortunately, providing module's artifactIds is not working at all. Sonatype 'Maven: The Complete Reference' docs are using multiproject example where directories names are matching artifactIds:
http://books.sonatype.com/mvnref-book/reference/_using_advanced_reactor_options.html
是否可以将-pl选项与artifactId一起使用?
Is it possible to use -pl option with artifactId?
推荐答案
是的,可以这样做.看看mvn --help
:
Yes, it's possible to do this. Take a look at mvn --help
:
-pl,--projects <arg> Comma-delimited list of specified
reactor projects to build instead
of all projects. A project can be
specified by [groupId]:artifactId
or by its relative path.
请特别注意,没有前导groupId
的artifactId
仍然具有前导冒号.
Note in particular that an artifactId
without a leading groupId
still has a leading colon.
因此,例如,在artifactId
与目录名相同的情况下,这三行都将引用Maven中的同一模块:
So, for example in a case where the artifactId
is the same as the directory name, these three lines would all refer to the same module in Maven:
-
mvn -pl maven-core
-
mvn -pl :maven-core
-
mvn -pl org.apache.maven:maven-core
mvn -pl maven-core
mvn -pl :maven-core
mvn -pl org.apache.maven:maven-core
这篇关于定义将在Maven多项目构建中构建的模块列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!