Reputation: 2058
I am using the maven jetty pluggin as follows:
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.5.v20120716</version>
<configuration>
<stopKey>1</stopKey>
<stopPort>9999</stopPort>
</configuration>
</plugin>
My web app is running on ec2 where we have a few environment variables setup (like CLOUD_DEV_PHASE). I was wondering if there is a way to put a dummy value for CLOUD_DEV_PHASE in the pom file so you don't have to do it on your system. Is there a way to do this?
I am looking for something similar to
CLOUD_DEV_PHASE=dev mvn jetty:run
Upvotes: 1
Views: 7745
Reputation: 3713
I would try to set the property env.CLOUD_DEV_PHASE
in the project section:
<project>
...
<properties>
<env.CLOUD_DEV_PHASE>dev</env.CLOUD_DEV_PHASE>
</properties>
...
</project>
or in the Jetty plugin configuration:
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<configuration>
...
<systemProperties>
<systemProperty>
<name>env.CLOUD_DEV_PHASE</name>
<value>dev</value>
</systemProperty>
</systemProperties>
</configuration>
</plugin>
Upvotes: 0
Reputation: 333
I saw this one in a forum. I hope it works on you.
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty.version}</version>
<configuration>
...
<env>
<wibble>pencil</wibble>
<foo>bar</foo>
<black>white</black>
</env>
...
</configuration>
</plugin>
Upvotes: 1
Reputation: 11154
I'm not sure to completely understand your question, but if you need to set an environment variable, I usually use the exec plugin : http://mojo.codehaus.org/exec-maven-plugin/
The following goal : http://mojo.codehaus.org/exec-maven-plugin/exec-mojo.html
Someting like this:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>setEnvVar</id>
<phase>initialize</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>export</executable>
<arguments>
<argument>CLOUD_DEV_PHASE=Something</argument>
</arguments>
</configuration>
</plugin>
Regards
Upvotes: 1
Reputation: 763
you means add system property? like this:
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<configuration>
<systemProperties>
<systemProperty>
<name>CLOUD_DEV_PHASE</name>
<value>dummy</value>
</systemProperty>
</systemProperties>
<webApp>
<contextPath>/test</contextPath>
</webApp>
</configuration>
</plugin>
for more info, check : http://wiki.eclipse.org/Jetty/Feature/Jetty_Maven_Plugin#Setting_System_Properties
Upvotes: 4