[英]How to list all activated profiles in mvn in a multimodule project
mvn help:active-profiles only list the profiles activate within the project + system settings you call it in. mvn help:active-profiles仅列出在项目中激活的配置文件+您调用它的系统设置。
It does not list the profiles that have been enabled/activated from ie the parent pom. 它不会列出已启用/激活的配置文件,即父pom。
Any any way to actually see the full list of activated profiles by other means than trial-and-error to look at what properties are enabled or not ? 有什么方法可以通过其他方式实际查看激活的配置文件的完整列表,而不是试错,以查看是否启用了哪些属性?
Another option is mvn help:all-profiles
, which also list inherited profiles. 另一个选项是
mvn help:all-profiles
,它还列出了继承的配置文件。
Displays a list of available profiles under the current project.
显示当前项目下的可用配置文件列表。 Note : it will list all profiles for a project.
注意 :它将列出项目的所有配置文件。 If a profile comes up with a status inactive then there might be a need to set profile activation switches/property.
如果配置文件的状态为非活动状态,则可能需要设置配置文件激活开关/属性。
More details in Maven's help plugin page Maven帮助插件页面中的更多细节
I double-checked this and indeed, inherited profiles aren't listed when mvn help:active-profiles
is being called. 我仔细检查了这一点,实际上,当调用
mvn help:active-profiles
时,未列出继承的配置mvn help:active-profiles
。 This is with maven-help-plugin
version 2.1.1. 这是使用
maven-help-plugin
版本2.1.1。
There is even a bug-report about this: MPH-79 . 甚至有关于此的错误报告: MPH-79 。
As a workaround, you can use older version: 作为解决方法,您可以使用旧版本:
mvn org.apache.maven.plugins:maven-help-plugin:2.0.2:active-profiles ...
这适用于maven 3.x mvn help:active-profiles
Do you always want to see the active profile in your build log? 您是否一直希望在构建日志中看到活动的配置文件? Then you could add the following plugin config to the <build> section.
然后,您可以将以下插件配置添加到<build>部分。
In this example I added the plugin to the phase 'compile'. 在这个例子中,我将插件添加到阶段'compile'。 It could easily be added to a different phase.
它可以很容易地添加到不同的阶段。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-help-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>show-profiles</id>
<phase>compile</phase>
<goals>
<goal>active-profiles</goal>
</goals>
</execution>
</executions>
</plugin>
mvn help:effective-profiles
用于列出活动配置文件
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.