You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Ian Pilcher <i....@comcast.net> on 2006/02/15 04:06:52 UTC

Property vs. user property - what's the difference?

Can someone explain the difference between a property and a user
property (or the difference between Project.setProperty and
Project.setUserProperty)?

Thanks!

-- 
========================================================================
Ian Pilcher                                        i.pilcher@comcast.net
========================================================================


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


Re: Property vs. user property - what's the difference?

Posted by Matt Benson <gu...@yahoo.com>.
I once researched this... I think what happened was
just that the author of <available> used the wrong
method call.  I can say this without sounding too
terrible because I did it once myself in Ant's code,
except that my mistake was discovered soon enough to
avoid compromising the API.  Regarding <available>,
backward compatibility being taken as seriously as it
is in Ant, the decision was made to let the error
stand rather than break builds in the wild which
depended on this behavior.  If I have told this story
incorrectly I'm sure one of the older hands will
correct me.  :)

-Matt

--- Patrick Martin <an...@gmail.com> wrote:

> Thanks a lot for this very useful and clear
> information.
> I am surprised to read that <available> can override
> properties. Is
> there a reason for it?
> Patrick M.
> 
> On 2/16/06, Stefan Bodewig <bo...@apache.org>
> wrote:
> > On Wed, 15 Feb 2006, Patrick Martin
> <an...@gmail.com> wrote:
> >
> > > Could you explain the "even more immutable" part
> of your mail ?
> >
> > Sure.
> >
> > Properties are not immutable at all if you use
> Ant's Java API.  It's
> > just that (almost[1]) all of the built-in Ant
> tasks refuse to change
> > the value of an existing property.  But it is
> trivial to write a task
> > that changes the value of a property and in fact a
> lot of people and
> > projects have done so.
> >
> > There are five property setting methods in Ant's
> Project class:
> >
> > setNewProperty        - sets a property, will
> never override an
> >                         existing one - user
> property or not.
> >                         Used by almost all
> built-in Ant tasks.
> > setProperty           - sets or overrides a
> property, will never override
> >                         a user property.  Used by
> <available>.
> > setPropertyInternal   - same as setProperty but
> without any warning if
> >                         it overrides a property.
> > setUserProperty       - sets or overrides a user
> property.  Used when
> >                         parsing the command line.
> > setInheritedProperty  - sets or overrides a user
> property.  Used for
> >                         <property> nested in Ant.
> >
> > So both "plain properties" and "user properties"
> are in fact mutable
> > if you use the Ant API.  Only one of the five
> setter methods will not
> > overwrite an existing property, only two of them
> will overwrite an
> > existing user property - which makes user
> properties "more immutable".
> >
> > Stefan
> >
> > Footnotes:
> > [1]  Since I know I'll have to explain the
> "almost", <available> will
> >      happily overwrite existing properties.
> >
> >
> >
> >
>
---------------------------------------------------------------------
> > 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
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


Re: Property vs. user property - what's the difference?

Posted by Stefan Bodewig <bo...@apache.org>.
On Thu, 16 Feb 2006, Patrick Martin <an...@gmail.com> wrote:

> I am surprised to read that <available> can override properties. Is
> there a reason for it?

Matt got it almost right.

Up to Ant 1.3 (I think) the check whether a property existed was
inside of the <property> task and not inside the setProperty method.
This left task writers who wanted to keep properties immutable with
implementing this check themselves (<uptodate> for example).

Then setProperty was "fixed" and we broke <available>.

I don't recall whether we broke any Gump[1] builds.  In any case at
that point <available> had been known as a workaround if you really
wanted to modify properties.  This had been mentioned on the user list
multiple times so we knew we'd break a lot of build files with the
next release.  setNewProperty was introduced and available used that.

Stefan

Footnotes: 
[1]  http://gump.apache.org/


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


Re: Property vs. user property - what's the difference?

Posted by Patrick Martin <an...@gmail.com>.
Thanks a lot for this very useful and clear information.
I am surprised to read that <available> can override properties. Is
there a reason for it?
Patrick M.

On 2/16/06, Stefan Bodewig <bo...@apache.org> wrote:
> On Wed, 15 Feb 2006, Patrick Martin <an...@gmail.com> wrote:
>
> > Could you explain the "even more immutable" part of your mail ?
>
> Sure.
>
> Properties are not immutable at all if you use Ant's Java API.  It's
> just that (almost[1]) all of the built-in Ant tasks refuse to change
> the value of an existing property.  But it is trivial to write a task
> that changes the value of a property and in fact a lot of people and
> projects have done so.
>
> There are five property setting methods in Ant's Project class:
>
> setNewProperty        - sets a property, will never override an
>                         existing one - user property or not.
>                         Used by almost all built-in Ant tasks.
> setProperty           - sets or overrides a property, will never override
>                         a user property.  Used by <available>.
> setPropertyInternal   - same as setProperty but without any warning if
>                         it overrides a property.
> setUserProperty       - sets or overrides a user property.  Used when
>                         parsing the command line.
> setInheritedProperty  - sets or overrides a user property.  Used for
>                         <property> nested in Ant.
>
> So both "plain properties" and "user properties" are in fact mutable
> if you use the Ant API.  Only one of the five setter methods will not
> overwrite an existing property, only two of them will overwrite an
> existing user property - which makes user properties "more immutable".
>
> Stefan
>
> Footnotes:
> [1]  Since I know I'll have to explain the "almost", <available> will
>      happily overwrite existing properties.
>
>
>
> ---------------------------------------------------------------------
> 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: Property vs. user property - what's the difference?

Posted by Stefan Bodewig <bo...@apache.org>.
On Wed, 15 Feb 2006, Patrick Martin <an...@gmail.com> wrote:

> Could you explain the "even more immutable" part of your mail ?

Sure.

Properties are not immutable at all if you use Ant's Java API.  It's
just that (almost[1]) all of the built-in Ant tasks refuse to change
the value of an existing property.  But it is trivial to write a task
that changes the value of a property and in fact a lot of people and
projects have done so.

There are five property setting methods in Ant's Project class:

setNewProperty        - sets a property, will never override an
                        existing one - user property or not.
                        Used by almost all built-in Ant tasks.
setProperty           - sets or overrides a property, will never override
                        a user property.  Used by <available>.
setPropertyInternal   - same as setProperty but without any warning if
                        it overrides a property.
setUserProperty       - sets or overrides a user property.  Used when
                        parsing the command line.
setInheritedProperty  - sets or overrides a user property.  Used for
                        <property> nested in Ant.

So both "plain properties" and "user properties" are in fact mutable
if you use the Ant API.  Only one of the five setter methods will not
overwrite an existing property, only two of them will overwrite an
existing user property - which makes user properties "more immutable".

Stefan

Footnotes: 
[1]  Since I know I'll have to explain the "almost", <available> will
     happily overwrite existing properties.



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


Re: Property vs. user property - what's the difference?

Posted by Ondřej Světlík <on...@svetlik.info>.
> Hello,
> Could you explain the "even more immutable" part of your mail ?
> Thanks,
> Patrick M.
>
> On 2/15/06, Stefan Bodewig <bo...@apache.org> wrote:
>> On Tue, 14 Feb 2006, Ian Pilcher <i....@comcast.net> wrote:
>>
>> > Can someone explain the difference between a property and a user
>> > property (or the difference between Project.setProperty and
>> > Project.setUserProperty)?
>>
>> user properties are the properties defined on the command line or as
>> nested <property> elements in <ant> tasks.  They are even more
>> immutable than plain properties and are passed down to child builds
>> accross <ant> even if inheritall is false.
>>
>> Stefan
>>
>> ---------------------------------------------------------------------
>> 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
>
>

I think that "even more" immutable are only properties defined on
command-line. These properties are passed to ant from jvm, that's why they
can't be reset or unset by any means. The only way to "forget" them is to
run ant as an external program using <apply> task.

Best regards

Ondrej Svetlik

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


One more Question regarding deployment in ANT and WebLogic

Posted by Shweta Bodade <sh...@in.ness.com>.
Hi,

 

            I could deploy my web application using Ant in WebLogic server 

But I get the following description when I deploy it, sorry for so many
questions but am a fresher and want to explore Ant for automation. 

Buildfile: E:\workspace2\Hello\src\build.xml

print message:

     [java] Warning: No targets were specified. Your application will not be
deployed anywhere.

     [java] To specify a target for your component, use the -component
argument

     [java] Done deploying jade with
e:\bea\user_projects\domains\mydomain\.\myserver\upload\jade\jade.war

BUILD SUCCESSFUL

Total time: 22 seconds

 

 

Because of this line that no targets were specified the context root is
missing 

Can u show me an example of specifying a target 

My code is 

 

 

<project name="Hello" default="print message"> 

      <target name="print message">

             <serverdeploy action="deploy" source="E:\jrt\jade.war">

                    <weblogic application="jade"

                        server="http://localhost:7001"

 
classpath="E:\bea\weblogic81\server\lib\weblogic.jar"

                        username="admin"

                        password="administrator"   
				component="myserver"        
				              

                        debug="true"/>

             </serverdeploy>

      </target>         

</project> 




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


RE: Property vs. user property - what's the difference?

Posted by Shweta Bodade <sh...@in.ness.com>.

Regards
Shweta ArunKumar Bodade,
 
Ness Technologies (India) Ltd,
No 33, 17th H Main Road,
6th Block, Koramangla,
Banglore - 560 095
 
Tel(office) : 51961000
-----Original Message-----
From: Patrick Martin [mailto:antuser@gmail.com] 
Sent: Wednesday, February 15, 2006 3:42 PM
To: Ant Users List
Subject: Re: Property vs. user property - what's the difference?

Hello,
Could you explain the "even more immutable" part of your mail ?
Thanks,
Patrick M.

On 2/15/06, Stefan Bodewig <bo...@apache.org> wrote:
> On Tue, 14 Feb 2006, Ian Pilcher <i....@comcast.net> wrote:
>
> > Can someone explain the difference between a property and a user
> > property (or the difference between Project.setProperty and
> > Project.setUserProperty)?
>
> user properties are the properties defined on the command line or as
> nested <property> elements in <ant> tasks.  They are even more
> immutable than plain properties and are passed down to child builds
> accross <ant> even if inheritall is false.
>
> Stefan
>
> ---------------------------------------------------------------------
> 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: Property vs. user property - what's the difference?

Posted by Patrick Martin <an...@gmail.com>.
Hello,
Could you explain the "even more immutable" part of your mail ?
Thanks,
Patrick M.

On 2/15/06, Stefan Bodewig <bo...@apache.org> wrote:
> On Tue, 14 Feb 2006, Ian Pilcher <i....@comcast.net> wrote:
>
> > Can someone explain the difference between a property and a user
> > property (or the difference between Project.setProperty and
> > Project.setUserProperty)?
>
> user properties are the properties defined on the command line or as
> nested <property> elements in <ant> tasks.  They are even more
> immutable than plain properties and are passed down to child builds
> accross <ant> even if inheritall is false.
>
> Stefan
>
> ---------------------------------------------------------------------
> 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: Property vs. user property - what's the difference?

Posted by Stefan Bodewig <bo...@apache.org>.
On Tue, 14 Feb 2006, Ian Pilcher <i....@comcast.net> wrote:

> Can someone explain the difference between a property and a user
> property (or the difference between Project.setProperty and
> Project.setUserProperty)?

user properties are the properties defined on the command line or as
nested <property> elements in <ant> tasks.  They are even more
immutable than plain properties and are passed down to child builds
accross <ant> even if inheritall is false.

Stefan

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