How to list all activated profiles in mvn in a multimodule project
Asked Answered
P

5

32

mvn help:active-profiles only list the profiles activate within the project + system settings you call it in.

It does not list the profiles that have been enabled/activated from i.e. the parent 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 ?

Pentapody answered 28/10, 2012 at 15:2 Comment(4)
Actually, mvn help:effective-profiles lists all profiles enabled for the current project.Bodleian
Yes, which does not include profiles from parent Pom.Pentapody
Unfortunately mvn help:effective-profiles does not exists. It is called mvn help:active-profiles.Montespan
@Montespan Sorry, of course it's active-profiles.Bodleian
B
14

I double-checked this and indeed, inherited profiles aren't listed when mvn help:active-profiles is being called. This is with maven-help-plugin version 2.1.1.

There is even a bug-report about this: MPH-79.

As a workaround, you can use older version:

mvn org.apache.maven.plugins:maven-help-plugin:2.0.2:active-profiles ...
Bodleian answered 29/10, 2012 at 10:6 Comment(1)
FYI, that bug report says that it has been fixed in mvn v 2.2Oust
G
25

Another option is mvn help:all-profiles, which also list inherited 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

Gaudery answered 16/9, 2013 at 16:38 Comment(0)
B
14

I double-checked this and indeed, inherited profiles aren't listed when mvn help:active-profiles is being called. This is with maven-help-plugin version 2.1.1.

There is even a bug-report about this: MPH-79.

As a workaround, you can use older version:

mvn org.apache.maven.plugins:maven-help-plugin:2.0.2:active-profiles ...
Bodleian answered 29/10, 2012 at 10:6 Comment(1)
FYI, that bug report says that it has been fixed in mvn v 2.2Oust
C
10

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.

In this example I added the plugin to the phase '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>
Comehither answered 1/5, 2018 at 8:22 Comment(0)
A
5

this works in maven 3.x mvn help:active-profiles

Annalee answered 7/10, 2016 at 19:23 Comment(0)
I
-3
mvn help:effective-profiles

Works to list the active profiles

Inhospitality answered 20/7, 2017 at 11:28 Comment(1)
[ERROR] Could not find goal 'effective-profiles' in plugin org.apache.maven.plugins:maven-help-plugin:2.2 among available goals expressions, active-profiles, effective-settings, system, effective-pom, help, all-profiles, describe, evaluate -> [Help 1]Embolden

© 2022 - 2024 — McMap. All rights reserved.