On Fri, 8 Feb 2002, GOMEZ Henri wrote:

> Date: Fri, 8 Feb 2002 18:10:57 +0100
> From: GOMEZ Henri <[EMAIL PROTECTED]>
> Reply-To: Tomcat Developers List <[EMAIL PROTECTED]>
> To: Tomcat Developers List <[EMAIL PROTECTED]>
> Subject: RE: Tomcat 3.3 and 4.x tuning via command line
>
> >I'm wondering whether we really need to build it in to Tomcat itself,
> >though.  Can't you accomplish the same thing by using a little
> >Ant script
> >and run a <filter> or <replace> task?  All this would require
> >is packaging
> >ant.jar along with Tomcat, or requiring users that need the facility to
> >download Ant themselves.
>
> Could you give us a little example of ant replace task ?
>
> It will be a great interest for the mass :)
>

There's a lot of power in what the <replace> task can do.  Here's a very
simple one that replaces the string "@port@" with the port number
specified by the "port" property:

  <project name="Create server.xml" default="generate">

    <target name="generate" description="Generate customized server.xml">
      <replace file="server.xml" token="@port@" value="${port}"
    </target>

  </project>

In your template server.xml, you'd have a <Connector> element like this:

  <Connector ... port="@port@" .../>

Now, you just run "ant -Dport=8085" and you've replaced the port number.
Generalizing this to replace lots of properties is straightforward.

See the Ant docs for more details <http://jakarta.apache.org/ant/>.

Craig


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to