tags:

views:

13

answers:

1

Two questions on configuring the jetty ant task

to get jetty to listen on a different port, I'm doing this in the jetty.xml:

 <Call name="addConnector">
    <Arg>
      <New class="org.mortbay.jetty.nio.SelectChannelConnector">
        <Set name="port"><SystemProperty name="jetty.port" default="9080"/></Set>
      </New>
    </Arg>
  </Call>

and referencing this in the ant script, e.g.

  <jetty tempDirectory="..." jettyXml="...jetty.xml">

Unfortunately this simply gets jetty to load both 9080 and 8080. How do I get jetty to not require 8080?

Second question - does the jetty task support forking the jetty process, or do I have to do that with a direct ant exec instead of using the jetty plugin?

A: 

Nevermind. For anyone stuck with the same issue, it can be solved like this:

<jetty tempDirectory="..."> 
     <connectors>
        <selectChannelConnector port="9999" />
      </connectors>
  </jetty>

The jetty.xml is removed, calling that adds the referenced port rather than replacing. Similar to the syntax

< systemProperties>
    <systemProperty name="jetty.port" value="9181"/>
  </systemProperties>

which replaces the port referenced in the jetty xml but adds to instead of overwriting the default port.

Steve B.