ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brian Agnew" <br...@oopsconsultancy.com>
Subject Re: how to use @@ ?
Date Tue, 29 Apr 2008 15:09:30 GMT
So (obviously) you'll need to download the xmltask.jar and reference it thus:

ant -lib xmltask.jar build.xml

(or put it in your Ant lib directory or somewhere on your classpath. The
Ant manual will advise you appropriately).

To do the below, a suitable XMLTask invocation would be:

<xmlcatalog id="dtds">
  <dtd publicId="-//Hibernate/Hibernate Configuration DTD 3.0//EN"
location="A LOCAL COPY OF YOUR DTD"/>
</xmlcatalog>

<target name="uncommentStuff">
 <xmltask source="tomcat.xml" dest="new-tomcat.xml">
  <xmlcatalog refid="dtds"/>
  <remove path="/hibernate-configuration/session-factory/property[1]"/>
  <uncomment path="/hibernate-configuration/session-factory/comment()[3]"/>
 </xmltask>
</target>

Briefly -

The <xmlcatalog> specifies a local copy of your DTD. Otherwise XMLTask
will go across the network to resolve it, and you may not be able to do
that (firewalls etc.)

The <remove> removes the Tomcat property section.

The <uncomment> uncomments the Weblogic section.

It's a bit of a baptism of fire if you're new to Ant. Sorry - hadn't fully
appreciated that when I replied initially...

Brian

On Tue, April 29, 2008 15:19, Alberto Ivo wrote:
> Hi Brian,
>
> that seems to be exactly what I want.. But I'm really new to this and
> didn't
> understand how to do it.. for me, that's very complicated. Let me explain
> my
> situation:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE hibernate-configuration PUBLIC
>         "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
>         "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
>
> <hibernate-configuration>
>
>     <session-factory>
>
>         <!-- Configuração Tomcat -->
>         <property
> name="connection.datasource">java:/comp/env/jdbc/pmpcDS</property>
>
>         <!-- Configuração Weblogic -->
>         <!-- <property name="connection.datasource">jdbc/pmpcDS</property>
> -->
>
>         ( . . . )
>
>     </session-factory>
>
> </hibernate-configuration>
>
>
> I didn't understand how i will uncomment the weblogic line and coment the
> tomcat line when I generate the WAR. Could you explain me?
>
> Thanks.
>


-- 
Brian Agnew                  http://www.oopsconsultancy.com
OOPS Consultancy Ltd
Tel: +44 (0)7720 397526
Fax: +44 (0)20 8682 0012


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message