views:

30

answers:

1

Is it possible to set environment variable with maven (OS: Linux)?

I already have user-defined properties (in the pom and in profiles.xml)....my problem is, how to execute following from Maven

export GGA_FRE=/path

So will be possible, that every developer can set his own path for the GGA_FRE.

+1  A: 

Use the exec:exec mojo.

  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <version>1.1</version>
    <executions>
      <execution>
        <id>exportVar</id>
        <phase>initialize</phase>
        <goals>
          <goal>exec</goal>
        </goals>
      </execution>
    </executions>
    <configuration>
      <executable>export</executable>
      <arguments>
        <argument>GGA_FRE=${my.path}</argument>
      </arguments>
    </configuration>
  </plugin>

now call it like this mvn install -Dmy.path=/var/users/groucho

seanizer