Reputation: 3134
I've a web application that runs with jetty. I include a client.jar in this web application for a functionality. client.jar needs a system property -Dconfig with location to the properties file. How do I pass this to when I start my application using jetty-runner ? I could only find setting it through jetty.xml but I'm trying to find if there is a way through command line.
Upvotes: 2
Views: 2384
Reputation: 1370
In our project, we have used below set of code to set system property while doing jetty:run
clean compile -Dcurrent.region=AIR jetty:run
Upvotes: 0
Reputation: 3134
This is not a solution to pass property through command line. I fixed this by passing below file jetty.xml to command line as below. I'm posting it here as it may help someone.
nohup $JAVA_HOME/bin/java -Denv=$1 -jar $LIB_PATH/jetty-runner-*.jar --config $CONF_PATH/jetty.xml $DIST_PATH/my-app*.war &
jetty.xml
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<Call class="java.lang.System" name="setProperties">
<Arg>
<New class="java.util.Properties">
<Call name="putAll">
<Arg>
<Call class="java.lang.System" name="getProperties" />
</Arg>
</Call>
<Call name="setProperty">
<Arg>iamconfig</Arg>
<Arg>iamclient.properties</Arg>
</Call>
</New>
</Arg>
</Call>
</Configure>
Upvotes: 2