简体   繁体   English

如何在多模块项目中列出mvn中所有激活的配置文件

[英]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.

相关问题 如何继承多模块Maven项目及其所有好处? - How to inherit from a multimodule Maven project with all its goodies? 使用Netbeans和Maven多模块项目中的配置文件为Windows和Linux构建 - Using profiles in Netbeans and Maven multimodule project to build for Windows and Linux 如何列出项目中定义的所有maven配置文件,包括所有子模块? - how to list all maven profiles defined in project including all sub modules? 如果激活多个配置文件,如何解决冲突的属性 - How are conflicting properties resolved if multiple profiles are activated 如何检测激活的maven配置文件? - How to detect what maven profiles are activated? 如何在多模块项目中(使用Shell脚本)从所有pom.xml文件中提取artifactId? - How to extract the artifactId from all pom.xml files using in a multimodule project (using shell script)? 如何svn checkout和checkin maven multimodule项目 - How svn checkout and checkin maven multimodule project 安装使用 mvn archetype:create-from-project 创建的多模块原型时出错 - Error installing a multimodule archetype created with mvn archetype:create-from-project 如何在Maven 2中更快地构建多模块项目? - How to build multimodule project faster in maven 2? 如何在Maven多模块项目中将jar从一个项目打包到另一个项目 - How to package jar from one project to another in maven multimodule project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM