Author |
Message
|
ganesh |
Posted: Mon Oct 25, 2010 8:17 pm Post subject: Pass a properties file in runtime to build file |
|
|
Master
Joined: 18 Jul 2010 Posts: 294
|
I want to pass runtime values to a java class which i am calling from a ant script.
Code: |
<project name="Deploy" default="deploybar">
<target name="deploybar" description="">
<java fork="true" failonerror="yes" classname="DeployBar" classpath="${ant}.bin"/>
</target>
</project> |
This java class takes values at runtime. I have the values for them in a environment specific properties file, I want to pass the properties file at runtime, could anyone guide me on how to attain this? |
|
Back to top |
|
 |
Vitor |
Posted: Tue Oct 26, 2010 2:37 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Do a search. This has been discussed many times in here, along with a number of better ways of providing environment specific data. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
ganesh |
Posted: Tue Oct 26, 2010 5:32 am Post subject: |
|
|
Master
Joined: 18 Jul 2010 Posts: 294
|
I know there is a better way, but i would like to try it this way. This java class has the mqsideploy utility in it and i would like to pass the env. specific broker name, EG.... etc. The broker name, EG.. are all stored in a .properties file which has to be passed at runtime and the script has to parse it and pass it to the java class as a runtime value. |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Oct 26, 2010 5:57 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
So you need to figure out how to pass data into a java runtime, such that your Java class can read it?
Or you need to figure out how to pass data into an ant script, such that your ant script can read it?
Neither of these have anything to do with Broker. |
|
Back to top |
|
 |
ganesh |
Posted: Tue Oct 26, 2010 6:09 am Post subject: |
|
|
Master
Joined: 18 Jul 2010 Posts: 294
|
mqjeff wrote: |
So you need to figure out how to pass data into a java runtime, such that your Java class can read it?
Or you need to figure out how to pass data into an ant script, such that your ant script can read it?
Neither of these have anything to do with Broker. |
I posted it here because i am trying to automate bar file deployment and the scripts and java classes are doing that for me. |
|
Back to top |
|
 |
WMBDEV1 |
Posted: Tue Oct 26, 2010 8:19 am Post subject: |
|
|
Sentinel
Joined: 05 Mar 2009 Posts: 888 Location: UK
|
ganesh wrote: |
I posted it here because i am trying to automate bar file deployment and the scripts and java classes are doing that for me. |
The point being that this forum is more committed to broker / MQ questions than specific ant questions and so you may get a better response in a dedicated ant / java forum
That aside, a very quick search for ant and java arguments led me here:
http://www.java-tips.org/other-api-tips/ant/how-to-use-java-task.html which should answer your question (assuming option 1 from Jeffs list). With a little bit more effort you could nail option 2 also.
Did you try searching before posting? |
|
Back to top |
|
 |
ganesh |
Posted: Tue Oct 26, 2010 9:14 am Post subject: |
|
|
Master
Joined: 18 Jul 2010 Posts: 294
|
WMBDEV1 wrote: |
ganesh wrote: |
I posted it here because i am trying to automate bar file deployment and the scripts and java classes are doing that for me. |
The point being that this forum is more committed to broker / MQ questions than specific ant questions and so you may get a better response in a dedicated ant / java forum
That aside, a very quick search for ant and java arguments led me here:
http://www.java-tips.org/other-api-tips/ant/how-to-use-java-task.html which should answer your question (assuming option 1 from Jeffs list). With a little bit more effort you could nail option 2 also.
Did you try searching before posting? |
Thanks first and yes i did search before posting. I came across this link while i was searching, anyways i will try searching and exploring further. |
|
Back to top |
|
 |
WMBDEV1 |
Posted: Tue Oct 26, 2010 10:32 am Post subject: |
|
|
Sentinel
Joined: 05 Mar 2009 Posts: 888 Location: UK
|
From that site: "Use nested <arg> and <jvmarg> elements to specify arguments for the Java class and the forked VM respectively."
What more are you looking for? |
|
Back to top |
|
 |
|