• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

how split data?

 
author & internet detective
Posts: 40791
828
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to come up with a way of allowing both the project name and (optionally) version name to be passed to Ant in the build file.

I came up with the following representation.


I've recently learned (from this forum) that I can use for each to loop through the comma delimitted part. Is there a way of separating out the project name and version number for each of those sets? I could use BSH scripting, but want to see if there is a way in pure Ant first.

On the other hand, if my representation doesn't make sense, I'd appreciate hearing about that too.
 
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not sure what you are trying to do. Is that code snippet from build.xml? The only way you can pass something to ant is to pass args, for example on the command line.

Maybe it would help if you explained what your goal is. Also, I would recommend extending ant and writing java code for performing extra tasks, if possible.
 
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jeanne
IMHO, in your case, write some bsf javascript or customized ant task would be an easy and better choice.
Roseanne
 
Jeanne Boyarsky
author & internet detective
Posts: 40791
828
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Andy,
It is from the build.properties file which gets loaded as properties in the Ant script.

Roseanne,
Thanks! I know how to do this using BSF. Just wanted to make sure I wasn't going down the wrong trail
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What about changing the properties to

projects=Project1,Project2,...
Project1.version=v1
Project2.version=v2
...

That should be quite easy to process with vanilla Ant + foreach.
 
Jeanne Boyarsky
author & internet detective
Posts: 40791
828
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ilja Preuss:
What about changing the properties to

projects=Project1,Project2,...
Project1.version=v1
Project2.version=v2
...

That should be quite easy to process with vanilla Ant + foreach.



I like it! Your solution is also more flexible if I decide to add any other options (like a repository). No parsing mess.
 
Ilja Preuss
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jeanne Boyarsky:


I like it!



 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic