|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
how to use @@ ?hello guys...
I just subscribe the list.. this is my very first post here.. I have a situation here... I would like to know how to substitute some line code via ant. let me explain better: In my hibernate.cfg.xml I have the lines: <!-- Tomcat --> <property name="connection.datasource">java:/comp/env/jdbc/pmpcDS</property> <!-- Weblogic --> <property name="connection.datasource">jdbc/pmpcDS</property> When I'm developing, I use the tomcat datasource and comment the weblogic datasource, when I generate the WAR to send to the server, I comment the tomcat line and take the comment ooff the weblogic line.. I would like to know how to automatize this with ant.. I saw that I could substitute the lines with @@linecode@@ but I didn't find anyplace to learn.. could anyone indicates a good tutorial for that.. or send me a example of code?? thanks in advance... |
|
|
Re: how to use @@ ?If you're doing XML stuff, you could use XMLTask.
http://www.oopsconsultancy.com/software/xmltask/ Specifically for what you want to do, XMLTask can perform a remove and uncomment. http://www.oopsconsultancy.com/software/xmltask/#usage.uncomment Brian On Tue, April 29, 2008 14:09, Alberto Ivo wrote: > hello guys... > > I just subscribe the list.. this is my very first post here.. > > I have a situation here... I would like to know how to substitute some > line > code via ant. let me explain better: > > In my hibernate.cfg.xml I have the lines: > > <!-- Tomcat --> > <property > name="connection.datasource">java:/comp/env/jdbc/pmpcDS</property> > > <!-- Weblogic --> > <property name="connection.datasource">jdbc/pmpcDS</property> > > When I'm developing, I use the tomcat datasource and comment the weblogic > datasource, when I generate the WAR to send to the server, I comment the > tomcat line and take the comment ooff the weblogic line.. > > I would like to know how to automatize this with ant.. I saw that I could > substitute the lines with @@linecode@@ but I didn't find anyplace to > learn.. > > > could anyone indicates a good tutorial for that.. or send me a example of > code?? > > > thanks in advance... > -- 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@... For additional commands, e-mail: user-help@... |
|
|
Re: how to use @@ ?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. |
|
|
Re: how to use @@ ?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@... For additional commands, e-mail: user-help@... |
| Free Forum Powered by Nabble | Forum Help |