views:

704

answers:

1

So, within the directory containing my GWT application, I can type in the console

ant devmode

And it will start up my GWT application as per usual. So far so good.

However, what if wish to specify the port as a dynamic argument when starting devmode. Something conceptually like:

ant devmode port=8821

Or am I supposed to pass in some system variable to GWT? What is the convention for this? Thanks.

+2  A: 

Passing an argument via ant can be done via the ant properties. The call would be:

ant devmode -Dport=8821

In your ant file specify a property port. The default value will be overridden when you pass the argument via the command line:

<property name="port" value="8080" />  //replace 8080 with the default value you want.

And in the ant location where you want to use the property, use it as follows:

<arg value="-port"/>
<arg value="${port}"/>

Update: fixed syntax, as suggested by Stephen, of property to make this example correct.

Hilbrand
Seems to work smashingly. Only change I had to make is that <property name="port" value="8080">should be<property name="port" value="8080"/>Thank you
Stephen Cagle