Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

different target calling different properties

 
siba swain
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

Currntly I have one requirement to load propeties based on target I am calling. I have 4 targets and each targets are for different environment like env1,env2,env3,env4

property files are env1.propeties,env2.propeties,env3.propeties,env4.propeties and Targets are as follows:



So this target depends on init.I want my properties for this environment get loaded before init gets called.

I dont want to use command line argument option to load the properties.Is there any other alternative???

Appreciate for help

 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow, there are several way to do this. Here's one:



Here's another:




and run it as:

ant -Denv=env1
 
siba swain
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As mentioned I dont want to pass any argument like -Denv=??? . Currently I have implented in the 1st mention way. but the problem is if I have 4 environments then I have to repeat the following code 4 times



Thanks for your reply.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe by using <ancall> you can avoid having targets env1, env2, env3 and env4. Something like this:



You might even be able to condense this into a single antcall by using the <for> tag from antcontrib.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic