java - How do I check if a environment variable exists in my pom.xml? -
if runs pom.xml
nasty error because environment variable not defined. trap , show more straightforward error problem can fixed defined environment variable. know not idea have environment variable in pom, time need to. clues?
the variable java_6_home, path jdk6 since default 1 jdk7
maven-enforcer-plugin can it:
<build> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-enforcer-plugin</artifactid> <version>1.3.1</version> <executions> <execution> <id>enforce-property</id> <goals> <goal>enforce</goal> </goals> <configuration> <rules> <requireenvironmentvariable> <variablename>java_6_home</variablename> <message>java_6_home system variable must set!</message> </requireenvironmentvariable> </rules> <fail>true</fail> </configuration> </execution> </executions> </plugin> </plugins> </build>
Comments
Post a Comment