I've searched the archives and have not found an answer to this question.

I have a profile whose activation I'd like to trigger based on the
"non-emptiness" of an environment variable.

When I run mvn help:active-profiles with that environment variable set, it
reports that no profiles are active.

My settings.xml file, where the profile is defined, looks like this (in
part):

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/POM/4.0.0";
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
                              http://maven.apache.org/xsd/settings-1.0.0.xsd
">

[stuff snipped here]

  <profiles>
    <profile>
      <id>Development Server</id>
      <activation>
        <property>
          <name>env.GLASSFISH_HOME</name>
        </property>
      </activation>
      <properties>
        <appserver.autodeploy.dir>${env.GLASSFISH_HOME
}/domains/domain1/autodeploy</appserver.autodeploy.dir>
      </properties>
    </profile>
  </profiles>
</settings>

I followed the example of the maven.apache.org page on build
profiles<http://maven.apache.org/guides/introduction/introduction-to-profiles.html>,
which says, in part:
*
Note* : Environment variable FOO would be set like env.FOO .

...but this only works if I do:

mvn help:active-profiles -Denv.GLASSFISH_HOME=foobar

...i.e. it is treated (by the help:active-profiles plugin, at any rate) as a
regular property, not an environment variable.

How, if not that way as documented, do I activate a profile based on the
presence of a non-empty environment variable value?

Thanks,
Laird

P. S.: The output of mvn --version is below:

Maven version: 2.0.8
Java version: 1.6.0_04
OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows"

Reply via email to