On Tue, 23 Aug 2005, Mick Knutson wrote: You're replacing the original source files, after they're copied to the webapp dir, so this is not going to work.
You want to have a postGoal on war:war-resources, and use ${maven.war.webapp.dir} as a base dir (which is target/<artifactId>/) and replace the files there. It's probably better to use 2 different property files containing the filters, load one of them, and copy the resources with filtering enabled (with tokens like @APPSRVR_JNDI_TOKEN@); the problem here is that the war plugin doesn't provide copying files with filtering, so your solution is probably the easiest. -- Kenney > OK, I found a couple of things, but I need to do the following: > I have an xml configuration file from Spring, that I need to replace a token > in, depending upong the type of build i.e: "maven.target.build=jboss", or > "maven.target.build=was51" > > I want to replace this token only when I add it to the war. > > So here is what I found, and I am not sure how to modify this to get it to > replace what I need: > > <postGoal name="war:webapp"> > <j:set var="targetBuild" value="${maven.target.build}"/> > <j:if test="${targetBuild == 'jboss'}"> > <ant:replace > file="${basedir}/conf/web/xml/applicationContext-hibernate.xml"> > <ant:replacefilter token="[APPSRVR_JNDI_TOKEN]" > value="${jboss.jndi.token}"/> > </ant:replace> > </j:if> > <j:if test="${targetBuild == 'was51'}"> > <ant:replace > file="${basedir}/conf/web/xml/applicationContext-hibernate.xml"> > <ant:replacefilter token="[APPSRVR_JNDI_TOKEN]" > value="${was51.jndi.token}"/> > </ant:replace> > </j:if> > </postGoal> > > But is this going to replace this token just prior to adding this file to > the war? > > > > > > Thank You > Mick Knutson > > Sr. Java/J2EE Consultant > BASE logic, inc. > (415) 648-1804 (S.F., CA) > http://www.BASELogic.com > > HP Consulting Services (Walnut Creek, CA) > > > > > >From: "Mick Knutson" <[EMAIL PROTECTED]> > >Reply-To: "Maven Users List" <users@maven.apache.org> > >To: users@maven.apache.org > >Subject: Need Maven example of ant replace task please... > >Date: Tue, 23 Aug 2005 09:38:57 -0700 > > > >I am trying to use the ant replace task function in my Maven build and want > >to see if anyone can help me with an example. > > > > > >Thank You > >Mick Knutson > > > >Sr. Java/J2EE Consultant > >BASE logic, inc. > >(415) 648-1804 (S.F., CA) > >http://www.BASELogic.com > > > >HP Consulting Services (Walnut Creek, CA) > > > > > > > >--------------------------------------------------------------------- > >To unsubscribe, e-mail: [EMAIL PROTECTED] > >For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- Kenney Westerhof http://www.neonics.com GPG public key: http://www.gods.nl/~forge/kenneyw.key --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]