You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2014/10/09 12:36:07 UTC

[Bug 57072] New: ${user.home} doesn't work when reading properties from a file with prefix and prefixValues="true"

https://issues.apache.org/bugzilla/show_bug.cgi?id=57072

            Bug ID: 57072
           Summary: ${user.home} doesn't work when reading properties from
                    a file with prefix and prefixValues="true"
           Product: Ant
           Version: 1.9.4
          Hardware: PC
                OS: FreeBSD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core tasks
          Assignee: notifications@ant.apache.org
          Reporter: lhersch@dssgmbh.de

Created attachment 32096
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=32096&action=edit
build.xml

Run the attached build.xml.
The output you get is like the following.

test:
     [echo] user.home = /home/lhersch
     [echo] test.my.home = /home/lhersch

Change the build.xml and set prefixValues=true in the property-task.
Now you get an output like the following.

test:
     [echo] user.home = /home/lhersch
     [echo] test.my.home = ${user.home}

I have tested this also with ant 1.8.4. There is the same behaviour.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 57072] ${user.home} doesn't work when reading properties from a file with prefix and prefixValues="true"

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57072

--- Comment #4 from lhersch@dssgmbh.de ---
Created attachment 32215
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=32215&action=edit
file for comment 3

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 57072] ${user.home} doesn't work when reading properties from a file with prefix and prefixValues="true"

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57072

--- Comment #6 from Stefan Bodewig <bo...@apache.org> ---
(In reply to lhersch from comment #3)
> Assuming that is not a bug, how can i solve the following issue.

You can't.  Not using the property task, at least.

The whole handling of prefixes in properties has been a source for several bugs
and we've had out share of backs and forths with incompatible changes while
trying to "fix" what isn't really fixable.  What you want to do is most likely
the opposite somebody else expects and we'd break this other person's build
file.

What you want to achieve can be done with loadproperties and an
expandproperties filter

  <loadproperties srcfile="build.properties" prefix="test" prefixValues="true">
    <filterchain>
      <expandproperties/>
    </filterchain>
  </loadproperties>

does what you want.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 57072] ${user.home} doesn't work when reading properties from a file with prefix and prefixValues="true"

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57072

--- Comment #3 from lhersch@dssgmbh.de ---
Assuming that is not a bug, how can i solve the following issue.

I use in my build-files something of the kind like in the attached files. This
work as expected with ant version 1.8.4. 

The output i get is:

test:
     [echo] test.my.ldir = /home/lhersch
     [echo] test.my.libf = /home/lhersch/somelib

With ant 1.9.4 i get the following output.

test:
     [echo] test.my.ldir = /home/lhersch
     [echo] test.my.libf = ${my.ldir}/somelib

Then i changed in my build.xml the value of prefixValues to true, because if
found the following in the description of the property-task.

"If you want to expand properties defined inside the same file and you use the
prefix attribute of the task, you must use the same prefix when expanding the
properties or set prefixValues to true."

After that the output with both versions of ant is:

test:
     [echo] test.my.ldir = ${user.home}
     [echo] test.my.libf = ${user.home}/somelib


Therefore i don't know, how should i change my build-files to work with ant
1.9.4.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 57072] ${user.home} doesn't work when reading properties from a file with prefix and prefixValues="true"

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57072

lhersch@dssgmbh.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |WORKSFORME

--- Comment #7 from lhersch@dssgmbh.de ---
That works, many thanks

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 57072] ${user.home} doesn't work when reading properties from a file with prefix and prefixValues="true"

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57072

--- Comment #1 from lhersch@dssgmbh.de ---
Created attachment 32097
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=32097&action=edit
build.properties

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 57072] ${user.home} doesn't work when reading properties from a file with prefix and prefixValues="true"

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57072

--- Comment #5 from lhersch@dssgmbh.de ---
Created attachment 32216
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=32216&action=edit
build.xml for comment 3

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 57072] ${user.home} doesn't work when reading properties from a file with prefix and prefixValues="true"

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57072

lhersch@dssgmbh.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #32215|file for comment 3          |build.properties for
        description|                            |comment 3

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 57072] ${user.home} doesn't work when reading properties from a file with prefix and prefixValues="true"

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57072

--- Comment #2 from Stefan Bodewig <bo...@apache.org> ---
I think this is not a bug but the behavior is correct.

When you set prefixvalues to true, Ant will add the prefix you've specified
when expanding ${} on the right hand side.  This applies to all properties,
system properties included.

-- 
You are receiving this mail because:
You are the assignee for the bug.