I've attached my properties file.
basically I have some env vars preset ( my computer ->
properties->advanced ) like ANT_HOME, JAVA_HOME, WL_HOME
I reference those vars in my properties file: ${env.JAVA_HOME} to build
other paths

ejb.dir=${env.JAVA_HOME}/path/to/whatever/you/want

( you have to make sure that your build.xml files define their environment
variable
to be 'env' for the above interpolation to work. ie <property
environment="env"/>)

I tell my build.xml files to use this property file: <property
file="nameofyourpropertyfileinalocationthatcanbefoundbyant"/>
And I use those predifined vars like this: <pathelement path="${ejb.dir}"/>
I have my property file in the same directory as my master build file that
calls other build files so that the properties filter down.
so all together now:

<property evironment="env"/>
<property file="yourpropertyfile"/>
<echo message="${some.property.in.your.property.file}"/>

hope this helps,
james

----- Original Message -----
From: "J2EE User" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, April 27, 2001 2:33 PM
Subject: Re: Execute another bat file.


> Hi James:
> I am relatively new to Ant. How and where do u set the global.properties
> file.
>
> Thanks
> J2EE User
> ----- Original Message -----
> From: <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, April 27, 2001 2:43 PM
> Subject: Re: Execute another bat file.
>
>
> > If you're trying to set up classpaths for build xml files I would
> recommend
> > that you put them in a global.properties file that ant has access to,
> > instead of trying to set up your env from within ant...  this way you
can
> > feed your various tasks the paths/classpaths they require explicitly.
env
> > scripts will only set vars for the process that executes the script
which
> is
> > unreliable if your build script is complex. (ie executes targets in
other
> > scripts, runs other apps, forks processes)....
> >
> >
> > ----- Original Message -----
> > From: "J2EE User" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Friday, April 27, 2001 1:08 PM
> > Subject: Re: Execute another bat file.
> >
> >
> > > Hi Simon, Aarti:
> > > It looks like this is what is exactly happening.
> > >
> > > Before executing the bat file, the classpath contains
> > > c:\jdk1.3\lib\tools.jar;.;
> > >
> > > Even after executing the bat file, the classpath remains the same. Ant
> > does
> > > not give me any errors. It says BUILD successful.
> > >
> > > However if I execute the bat file from the command prompt directly,
the
> > > classpath is set accordingly. Is there any workaround for this.
> > >
> > > I am attaching my env.bat file, which is in c:\bea folder.
> > >
> > > Thanks in advance
> > >
> > > ----- Original Message -----
> > > From: <[EMAIL PROTECTED]>
> > > To: <[EMAIL PROTECTED]>
> > > Sent: Friday, April 27, 2001 1:16 PM
> > > Subject: RE: Execute another bat file.
> > >
> > >
> > > > J2EE user
> > > >
> > > > The fact that your classpath may not be set is not necessarily
> > indicative
> > > of
> > > > the fact your bat file did not execute.
> > > >
> > > > I can't say what happens inside ant, but from an NT point of view,
if
> > the
> > > > execution of the bat file was inside another process then you will
not
> > see
> > > > the values set when the process terminates.
> > > >
> > > > For this test c:\bea\env.bat contains the following code:
> > > > @echo off
> > > > echo hello
> > > > set testvalue=test
> > > > echo %testvalue%
> > > >
> > > > CASE I - running the bat in another process
> > > > ------
> > > > C:\>cmd /c c:\bea\env.bat
> > > > hello
> > > > test
> > > >
> > > > C:\>echo %testvalue%
> > > > %testvalue%
> > > >
> > > > CASE II - running the bat in the same process
> > > > -------
> > > > C:\>c:\bea\env.bat
> > > > hello
> > > > test
> > > >
> > > > C:\>echo %testvalue%
> > > > test
> > > >
> > > > And .. I wonder if this is what you're seeing .. certainly when I
run
> > the
> > > > same batch file using your build script in ant I get the following
> > > results:
> > > >
> > > > C:\>ant -buildfile c:\temp\build.xml
> > > > Buildfile: c:\temp\build.xml
> > > >
> > > > init:
> > > >      [echo] Begining execution of the bat file
> > > >      [exec] hello
> > > >      [exec] test
> > > >
> > > > BUILD SUCCESSFUL
> > > >
> > > > Total time: 0 seconds
> > > > C:\>echo %testfile%
> > > > %testfile%
> > > >
> > > > Try putting some echo statements in your batch file and see if these
> are
> > > > printed when you run.
> > > >
> > > > Simon
> > > >
> > > > -----Original Message-----
> > > > From: J2EE User [mailto:[EMAIL PROTECTED]]
> > > > Sent: 27 April 2001 17:31
> > > > To: [EMAIL PROTECTED]
> > > > Subject: Re: Execute another bat file.
> > > >
> > > >
> > > > Simon:
> > > > Even my build was successful. But it does not seem to execute the
bat
> > > file.
> > > >
> > > > env.bat file attempts to set the classpath, but after ant completes
> the
> > > > excution, the classpath is still not set.
> > > > Thanks
> > > > J2EE User
> > > > ----- Original Message -----
> > > > From: <[EMAIL PROTECTED]>
> > > > To: <[EMAIL PROTECTED]>
> > > > Sent: Friday, April 27, 2001 11:50 AM
> > > > Subject: RE: Execute another bat file.
> > > >
> > > >
> > > > > I had go with your sample code and the env.bat file I created ran!
> > > > >
> > > > > The contents of the env.bat:
> > > > > @echo off
> > > > > echo "hello"
> > > > >
> > > > > I also wrapped your target with the following project definitions:
> > > > >
> > > > > <project name="test" default="init" basedir=".">
> > > > > <target name="init">
> > > > >       <tstamp/>
> > > > >       <echo message="Begining execution of the bat file"/>
> > > > >       <exec executable="c:\bea\env.bat">
> > > > >     </exec>
> > > > > </target>
> > > > > </project>
> > > > >
> > > > > I ran if from c:\ but before doing that I set the following
> > environment
> > > > > variables:
> > > > > C:\>path=c:\jakarta-ant-1.3\bin;%path%
> > > > > C:\>set ant_home=c:\jakarta-ant-1.3
> > > > > C:\>set java_home=C:\jdk1.3.0_02
> > > > >
> > > > > And I got the following results:
> > > > >
> > > > > C:\>ant -buildfile c:\temp\build.xml
> > > > > Buildfile: c:\temp\build.xml
> > > > >
> > > > > init:
> > > > >      [echo] Begining execution of the bat file
> > > > >      [exec] "hello"
> > > > >
> > > > > BUILD SUCCESSFUL
> > > > >
> > > > > Total time: 0 seconds
> > > > > C:\>
> > > > >
> > > > > I hope there's someting here that may help :-).
> > > > >
> > > > >
> > > > >
> > > > > Simon
> > > > >
> > > > > -----Original Message-----
> > > > > From: J2EE User [mailto:[EMAIL PROTECTED]]
> > > > > Sent: 27 April 2001 16:37
> > > > > To: [EMAIL PROTECTED]
> > > > > Subject: Execute another bat file.
> > > > >
> > > > >
> > > > > Friends:
> > > > > I have all my classpath settings and environment variables
settings
> in
> > a
> > > > > batch file called env.bat
> > > > >
> > > > > From build.xml I want to call the env.bat so that I do not have to
> do
> > > the
> > > > > class path settings in every build.xml file.
> > > > >
> > > > > Here is the build.xml file snippet:
> > > > >
> > > > > <!--Execute the bat file that sets the environment -->
> > > > > <target name="init">
> > > > >       <tstamp/>
> > > > >       <echo message="Begining execution of the bat file"/>
> > > > >       <exec executable="c:\bea\env.bat">
> > > > >     </exec>
> > > > > </target>
> > > > >
> > > > > When I run ant, it says build successful, but the env.bat is not
> > > executed.
> > > > > Any ideas?
> > > > >
> > > > >
> > > > > Thanks in advance
> > > > >
> > > >
> > >
> >
>
> --------------------------------------------------------------------------
> > > > ----
> > > > > Part of the Halifax Group, Halifax plc, Registered in England No.
> > > 2367076.
> > > > Registered Office: Trinity Road, Halifax, West Yorkshire HX1 2RG.
> > > Represents
> > > > only the Halifax Financial Services Marketing Group for the purposes
> of
> > > > advising on and selling life assurance, pensions and unit trust
> > business.
> > > > The Marketing Group is regulated by the Personal Investment
Authority.
> > > > Switchboard 01422 333333.
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
>
============================================================================
> > > > ==
> > > > >
> > > > >
> > > >
> > >
> >
>
> --------------------------------------------------------------------------
> > > ----
> > > > Part of the Halifax Group, Halifax plc, Registered in England No.
> > 2367076.
> > > Registered Office: Trinity Road, Halifax, West Yorkshire HX1 2RG.
> > Represents
> > > only the Halifax Financial Services Marketing Group for the purposes
of
> > > advising on and selling life assurance, pensions and unit trust
> business.
> > > The Marketing Group is regulated by the Personal Investment Authority.
> > > Switchboard 01422 333333.
> > > >
> > > >
> > > >
> > >
> >
>
============================================================================
> > > ==
> > > >
> > > >
> > >
> >
> >
>
>

global.properties

Reply via email to