troubleshooting Question

ANT ?tion - alternative to "available file" option

Avatar of lphillips120898
lphillips120898 asked on
JavaJava EE
9 Comments1 Solution340 ViewsLast Modified:
I need to provide some info before I go into my question.  I am using a single ANT build.xml for several projects, the goal is to keep the build.xml generic and use properties files for each of the projects.  Due to this I've built it to accomodate all projects.

Using a web module (WSAD terminology) for an example I will have one OR more replace strings for files within that module for the different projects.  The information regarding the replacement strings resides in each Projects property file, and looks something like this:

** PROPERTIES SET IN THE PROJECTS PROPERTY FILE ******
WEB.Modify1.file=C:\\ccView\\${VOB.project.name}\\${VOB.project.name}_vob\\code\\${WEB1.project.name}\\${WEB.content}\\WEB-INF\\ibm-web-bnd.xmi
WEB.Token1.string=virtualHostName="default_host"
WEB.Value1.string=virtualHostName="VHMyTime"
** END **

I currently using the following code to look for the presence of a file (stringreplacement1.txt) to determine if I should call the target "replaceString1".  This is a real pain, because I have to remember to create the stringreplacement1.txt file, and it is an even bigger pain when there are lots of replacements (i.e. have to create stringreplacement2.txt, etc..).

** CODE USED TO CHECK FOR EXISTENCE OF STRINGREPLACEMENT1.TXT **
     <available file="${global.vobAppBuildCode.dir}/${module.project.name}/stringreplacement1.txt" type="file" property="stringreplacement1.exists"/>
     <antcall target="replaceString1">
          <param name="Modify1.file" value="${WEB.Modify1.file}"/>
          <param name="Replace1.string" value="${WEB.Token1.string}"/>
          <param name="Replacement1.string" value="${WEB.Value1.string}"/>
     </antcall>
** END **

Can anyone suggest a better way to do this?  Is there a way to check if there is a value associated with "WEB.Modify1.file", and if so then do the antcall?

Thanks,

Lisa
ASKER CERTIFIED SOLUTION
msmolyak

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 9 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros