Hi,

First I have added the documentation about the opportunities like this (and other one as well a few days before, cause there had been no documentation about that at all https://issues.apache.org/jira/browse/MNGSITE-234):


<profiles>
  <profile>
    <activation>
      <property>
        <name>!debug</name>
      </property>
    </activation>
    ...
  </profile>
</profiles>

which means if the property does not exist...and also works exactly like this. The value does not matter nor is needed to give some.

If I argue from a logical point of view I would say (and expect):
<profiles>
  <profile>
    <activation>
      <property>
        <name>debug</name>
        <value>!true</value>
      </property>
    </activation>
    ...
  </profile>
</profiles>

This would mean: The value is not equal "true"...but the property must exist...so something like "-Ddebug=WHATEVER"

The current behaviour is that the previous sentence will be calculated by Maven as:

The property is not important nor is needed to exists..and the values is not equal to "true"..which I think is wrong...

So it is not possible to express a thing like this:


<profiles>
  <profile>
    <activation>
      <property>
        <name>environment</name>
        <value>!dev</value>
      </property>
    </activation>
    ...
  </profile>
</profiles>

So this will be activated always...So the call:


mvn package -Denvironment=prod
mvn package

would be equivalent...which I think is wrong...

So it is not possible to identify a difference between those two Maven calls.


Furthermore if I like to use a combination of two profiles like this:

<profiles>
  <profile>
    <id>not-existing</id>
    <activation>
      <property>
        <name>!environment</name>
      </property>
    </activation>
    ...
  </profile>
  <profile>
    <id>not-dev</id>
    <activation>
      <property>
        <name>environment</name>
        <value>!dev</value>
      </property>
    </activation>
    ...
  </profile>
</profiles>

So if I call maven via:


mvn package

the last will take precendence...


Kind regards
Karl Heinz Marbaise

On 12/08/16 19:32, Robert Scholte wrote:
Hi,

Yes, this is correct. Just to clarify: -Dx is always the same is
-Dx=true [1]
I'd like to add -Dprofilea= : profile activated

5. mvn initialize -Dprofilea= : profile activated

maybe if the property was called skipITs instead of profilea the
examples are better to follow, i.e. always activate this profile (with
integration-tests), *unless* skipITs is true.

Robert

[1]
https://maven.apache.org/ref/3.3.9/maven-embedder/xref/org/apache/maven/cli/MavenCli.html#L1544


On Fri, 12 Aug 2016 18:59:14 +0200, Guillaume Boué <gb...@apache.org>
wrote:

Hi Robert,

 If this is expected, I think the documentation in
http://maven.apache.org/guides/introduction/introduction-to-profiles.html
should indeed be clarified. Currently, in that situation, it says

 "The following profile will be activated when the system property
"debug" is defined with a value which is not "true"."

 In this case, when invoking Maven with "mvn initialize", profilea
isn't defined so I would expect the profile not to be activated. This
is also what would happen if the value in the profile activation was
commented out.

 To recap, this is the current result with Maven 3.3.9 for this
situation (and latest 3.4.0-SNAPSHOT):

  1. mvn initialize: profile activated

 2. mvn initialize -Dprofilea: profile not activated

 3. mvn initialize -Dprofilea=false: profile activated

 4. mvn initialize -Dprofilea=true: profile not activated

 Guillaume


Message du 12/08/16 18:34
De : "Robert Scholte"
A : "Maven Developers List"
Copie à :
Objet : Re: Profile Activation

Hi Karl Heinz,

you should read the activation like this:
always activate, *unless* profilea is true.
So it says nothing about the availability of the property.
Maybe the documentation isn't clear enough.

Robert

On Fri, 12 Aug 2016 17:45:21 +0200, Karl Heinz Marbaise
 wrote:

> Hi to all,
>
> I have the following profile:
>
>
>
> profile-not-value-true
>
>
> profilea
> !true
>
>
>
>
>
> com.soebes.maven.plugins
> echo-maven-plugin
>
>
> initialize
>
> echo
>
>
>
>
>
> profile not value true
>
>
>
>
>
>
>
> So the question is: What would you expect you need to do to activate
> this profile?
>
> Currently this profile is activated cause if I don't define the
property
> "profilea" at all it seemed to that Maven is assuming this means "not
> value 'true'" ?
>
> I have assumed it should be activated if the property exists which
means
> giving it on command line like this:
>
> mvn -Dprofilea
>
>
>
> WDYT ?
>
> Kind regards
> Karl Heinz Marbaise
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
> For additional commands, e-mail: dev-h...@maven.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org




Mit freundlichem Gruß
Karl-Heinz Marbaise
--
SoftwareEntwicklung Beratung Schulung    Tel.: +49 (0) 2405 / 415 893
Dipl.Ing.(FH) Karl-Heinz Marbaise        USt.IdNr: DE191347579
Hauptstrasse 177
52146 Würselen                           http://www.soebes.de

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org

Reply via email to