tags:

views:

92

answers:

2

I use in my project the Jetty-task to execute a webapp. Can I somehow set the working-directory used by Jetty as the servlet-container is started?

A: 

Does the tempDirectory attribute not do what you want?

Kevin
No, that defines the directory used by jetty to save temporary data, but it is not the current working-directory.
Mnementh
What is jetty using the current directory for such that you want to change it?
Kevin
+1  A: 

I don't think that you can since the ant task runs jetty in the same VM and there is famously no way to set the current working directory for a running VM. You can try adding a system property for user.dir but that might not do quite what you want. You could also use the apply task to relaunch ant with a new working directory with a snippet like

<apply executable="${ant.home}/bin/ant" dir="/new/working/directory/here">
  <arg value="-f"/>
  <arg value="${ant.file}"/>
  <arg value="run-jetty"/>
</apply>
Geoff Reedy