You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Chris <ch...@branaghgroup.com> on 2004/07/30 18:22:15 UTC

Call an ant build file from a java file?

Is it possible to execute ant build files from a java source?

Chris

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: change to a property

Posted by "mail.laconiadatasystems.com" <we...@laconiadatasystems.com>.
Thats what I was looking for
Thanks Dale!
-Martin
----- Original Message -----
From: "Dale Anson" <da...@germane-software.com>
To: "Ant Users List" <us...@ant.apache.org>
Sent: Saturday, July 31, 2004 12:19 PM
Subject: Re: change to a property


> Another option would be to use the 'variable' task from ant-contrib.
> 'variable' is used exactly like a property, but is mutable.
>
> Dale
>
>
> Bill Rich wrote:
> > Properties are immutable so you can not change them once they are set.
But,
> > you can specify the value multiple times so that only the first one will
> > take effect.  You can specify the value of a property on the command
line
> > (-Dprop=value).  This will be the first setting of the property so no
other
> > settings in the ant file will override it.
> >
> > Or if you can't/won't specify it on the command line you may need some
extra
> > code to determine which one you want to set in the ant file.  You could
test
> > to see if an environment var is set and use it or use a default value.
> >
> > I generally use a three tier approach --
> > 1. Set from the command line
> > 2. Set from a .properties file loaded by the ant file (before any other
> > target gets control)
> > 3. Set default value in the ant file
> >
> > Bill Rich
> > Wilandra Consulting LLC
> > 1325 Addiewell Place
> > San Jose, CA  95120-3905
> > phone:      +1 408 268-2452
> > mobile:     +1 408 410-9713
> > Santa Cruz: +1 831 464-9007
> > fax:        +1 413 669-9716
> > billrich@wilandra.com or billrich@attglobal.net
> > http://www.wilandra.com
> >
> > -----Original Message-----
> > From: mail.laconiadatasystems.com
[mailto:webmaster@laconiadatasystems.com]
> > Sent: Saturday, July 31, 2004 4:14 AM
> > To: Ant Users List
> > Subject: change to a property
> >
> > I have a situation where a default value of a property should be
overwritten
> > I was contemplating pegging the property to an environment variable but
> > couldnt find a working example Does anyone have an example of a property
> > which changes because of an environment variable change and how to
implement
> > this ???
> > thanks,
> > martin
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional
> > commands, e-mail: user-help@ant.apache.org
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: change to a property

Posted by Dale Anson <da...@germane-software.com>.
Another option would be to use the 'variable' task from ant-contrib. 
'variable' is used exactly like a property, but is mutable.

Dale


Bill Rich wrote:
> Properties are immutable so you can not change them once they are set.  But,
> you can specify the value multiple times so that only the first one will
> take effect.  You can specify the value of a property on the command line
> (-Dprop=value).  This will be the first setting of the property so no other
> settings in the ant file will override it.
> 
> Or if you can't/won't specify it on the command line you may need some extra
> code to determine which one you want to set in the ant file.  You could test
> to see if an environment var is set and use it or use a default value.
> 
> I generally use a three tier approach --
> 1. Set from the command line
> 2. Set from a .properties file loaded by the ant file (before any other
> target gets control)
> 3. Set default value in the ant file
> 
> Bill Rich
> Wilandra Consulting LLC
> 1325 Addiewell Place
> San Jose, CA  95120-3905
> phone:      +1 408 268-2452
> mobile:     +1 408 410-9713
> Santa Cruz: +1 831 464-9007
> fax:        +1 413 669-9716
> billrich@wilandra.com or billrich@attglobal.net
> http://www.wilandra.com
> 
> -----Original Message-----
> From: mail.laconiadatasystems.com [mailto:webmaster@laconiadatasystems.com] 
> Sent: Saturday, July 31, 2004 4:14 AM
> To: Ant Users List
> Subject: change to a property
> 
> I have a situation where a default value of a property should be overwritten
> I was contemplating pegging the property to an environment variable but
> couldnt find a working example Does anyone have an example of a property
> which changes because of an environment variable change and how to implement
> this ???
> thanks,
> martin
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional
> commands, e-mail: user-help@ant.apache.org
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: change to a property

Posted by "mail.laconiadatasystems.com" <we...@laconiadatasystems.com>.
Hello All:
Is there any way to change a property or variable from the default Datatype
of String
to Integer?
Many Thanks,
-martin


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: change to a property

Posted by Bill Rich <bi...@attglobal.net>.
Properties are immutable so you can not change them once they are set.  But,
you can specify the value multiple times so that only the first one will
take effect.  You can specify the value of a property on the command line
(-Dprop=value).  This will be the first setting of the property so no other
settings in the ant file will override it.

Or if you can't/won't specify it on the command line you may need some extra
code to determine which one you want to set in the ant file.  You could test
to see if an environment var is set and use it or use a default value.

I generally use a three tier approach --
1. Set from the command line
2. Set from a .properties file loaded by the ant file (before any other
target gets control)
3. Set default value in the ant file

Bill Rich
Wilandra Consulting LLC
1325 Addiewell Place
San Jose, CA  95120-3905
phone:      +1 408 268-2452
mobile:     +1 408 410-9713
Santa Cruz: +1 831 464-9007
fax:        +1 413 669-9716
billrich@wilandra.com or billrich@attglobal.net
http://www.wilandra.com

-----Original Message-----
From: mail.laconiadatasystems.com [mailto:webmaster@laconiadatasystems.com] 
Sent: Saturday, July 31, 2004 4:14 AM
To: Ant Users List
Subject: change to a property

I have a situation where a default value of a property should be overwritten
I was contemplating pegging the property to an environment variable but
couldnt find a working example Does anyone have an example of a property
which changes because of an environment variable change and how to implement
this ???
thanks,
martin


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional
commands, e-mail: user-help@ant.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


change to a property

Posted by "mail.laconiadatasystems.com" <we...@laconiadatasystems.com>.
I have a situation where a default value of a property should be overwritten
I was contemplating pegging the property to an environment variable but
couldnt find
a working example
Does anyone have an example of a property which changes because of an
environment variable
change and how to implement this ???
thanks,
martin


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Call an ant build file from a java file?

Posted by Matt Benson <gu...@yahoo.com>.
--- Chris <ch...@branaghgroup.com> wrote:

> Is it possible to execute ant build files from a
> java source?
> 
> Chris

Yes, one quick place to look would be in the testcases
subdivision of Ant's
source--org.apache.tools.ant.BuildFileTest in
particular may give you a nice head start.  Also you
should definitely read "Developing with Ant">"Using
Ant Tasks Outside of Ant" from the manual.

-Matt


		
__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org