Question: How can i set up an environment variable (in other words internally accessible by `System.getenv("APP_HOME")` in a pom file?

```
APP_HOME=/path/home

```

I realize i can set it up in `.profile`, but wonder if pom can do the same trick.

Per bmargulies's suggestion below, i tried the following, without luck

```
<build>
    <finalName>KvpStore</finalName>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
                <encoding>UTF-8</encoding>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.12.4</version>
            <configuration>
                <includes>
                    <include>**/*Test*.java</include>
                </includes>
                <environmentVariables>
                    <APP_NAME>blah_blah</APP_NAME>  <------------------------
                </environmentVariables>
            </configuration>
        </plugin>
    </plugins>
</build>

```

Answer: 
Some plugins, like surefire, let you set them. There's no way, in general, in the pom.

The doc for surefire is is [here](http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#environmentVariables). Surefire will set environment variables for the duration of the run of the tests, not for anything else. And you have to make surefire fork.

In the configuration ...

```
<configuration>
  <forkMode>always</forkMode>
  <environmentVariables>
     <var1>val1</var1>
  </environmentVariables>
</configuration>

```
The [documentation of the maven-surefire-plugin](http://maven.apache.org/surefire/maven-surefire-plugin/examples/system-properties.html) show examples and describes how to do such things of setting up system properties.

```
<configuration>
  <systemPropertyVariables>
    <propertyName>propertyValue</propertyName>
    <buildDirectory>${project.build.directory}</buildDirectory>
    [...]
  </systemPropertyVariables>
</configuration>

```

It might be better to use them instead of environment variable, cause it's simpler to use them, cause env variable needed to setup correctly and the cmd.exe and the jvm must be restarted to get them working.

It is not necessary to configure the includes for the tests, cause [maven-surefire-plugin](http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#includes) has already the following defaults:

```
<includes>
 <include>**/Test*.java</include>
 <include>**/*Test.java</include>
 <include>**/*TestCase.java</include>
</includes>

```