简体   繁体   中英

Jetty ant task configuration

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, eg

<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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM