I would have thought that 'env.JAVA_HOME' would have worked, but it appears
that it does not.
If you don't want to write a rule, it looks like you can workaround with an
intermediate property. Just set a property to the value of the environment
variable and enforce that property. A tiny bit more confusing, but it's less
code, and less to change when support for this is added to the plugin.
Example:
..
<properties>
<javaHome>${env.JAVA_HOME}</javaHome>
</properties>
..
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>enforce-property</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireProperty>
<property>javaHome</property>
</requireProperty>
</rules>
<fail>true</fail>
</configuration>
</execution>
</executions>
</plugin>
..
--
Matthew Jaskula
[EMAIL PROTECTED]
> From: Stephen Connolly <[EMAIL PROTECTED]>
> Reply-To: Maven Users List <[email protected]>
> Date: Wed, 10 Dec 2008 14:25:13 +0000
> To: Maven Users List <[email protected]>
> Subject: Re: Does requireProperty consider system environment variables?
>
> Write a custom enforcer rule!
>
> 2008/12/10 Jaikiran <[EMAIL PROTECTED]>
>
>>
>> I am using Maven-2.0.9 and the enforcer plugin within my pom
>> http://maven.apache.org/plugins/maven-enforcer-plugin/rules/index.html
>> http://maven.apache.org/plugins/maven-enforcer-plugin/rules/index.html
>>
>> Within this plugin i am using the requireProperty rule to ensure that a
>> environment property is set by the user before running mvn
>>
>> http://maven.apache.org/plugins/maven-enforcer-plugin/rules/requireProperty.h
>> tml
>>
>> http://maven.apache.org/plugins/maven-enforcer-plugin/rules/requireProperty.h
>> tml
>>
>> Here's the pom:
>>
>> <plugin>
>> <groupId>org.apache.maven.plugins</groupId>
>> <artifactId>maven-enforcer-plugin</artifactId>
>> <executions>
>> <execution>
>> <id>enforce-property</id>
>> <goals>
>> <goal>enforce</goal>
>> </goals>
>> <configuration>
>> <rules>
>>
>> <requireProperty>
>>
>> <property>JAVA_HOME</property>
>> <message>"Please set
>> JAVA_HOME"</message>
>> </requireProperty>
>> </rules>
>> <fail>true</fail>
>> </configuration>
>> </execution>
>> </executions>
>> </plugin>
>>
>>
>> This rule always fails even if the user has set the JAVA_HOME from the
>> command prompt:
>> export JAVA_HOME=/home/me/Java
>>
>> Does this rule, consider the system level environment variables? I could
>> test the enforcer rule successfully against a property that was set within
>> the pom. Is there any other way i can enforce the JAVA_HOME to be set?
>> --
>> View this message in context:
>> http://www.nabble.com/Does-requireProperty-consider-system-environment-variab
>> les--tp20936086p20936086.html
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
Visit our website at http://www.nyse.com
****************************************************
Note: The information contained in this message and any attachment
to it is privileged, confidential and protected from disclosure. If the
reader of this message is not the intended recipient, or an employee
or agent responsible for delivering this message to the intended
recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly prohibited.
If you have received this communication in error, please notify the
sender immediately by replying to the message, and please delete
it from your system. Thank you. NYSE Euronext, Inc.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]