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 2008/10/03 18:31:54 UTC

DO NOT REPLY [Bug 45944] New: Bug using the file element as a nested element in the Copy task

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

           Summary: Bug using the file element as a nested element in the
                    Copy task
           Product: Ant
           Version: 1.7.1
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: Core
        AssignedTo: notifications@ant.apache.org
        ReportedBy: elvanor@gentoo.org


This does not work even if you wrap these file elements in a resources element.
The last example on the manual, at URL:

http://ant.apache.org/manual/CoreTasks/copy.html

actually fails. No files are copied.

Eg, the following task

  <copy todir="dest">
        <resources>
          <file file="src_dir/file1.txt"/>
          <file file="src_dir/file2.txt"/>
        </resources>
  </copy>

won't copy any files. Filing the bug as major as a manual example breaks (!)

Note: a fileset with one element works. Maybe the <file> resource element is
just obsolete? (would be strange though).


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 45944] Bug using the file element as a nested element in the Copy task

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





--- Comment #2 from Stefan Bodewig <bo...@apache.org>  2008-10-06 06:27:38 PST ---
(In reply to comment #1)

>   <copy todir="dest">
>         <resources>
>           <file basedir="src_dir" file="file1.txt"/>
>           <file basedir="src_dir" file="file2.txt"/>
>         </resources>
>   </copy>

should have been

  <copy todir="dest">
        <resources>
          <file basedir="src_dir" file="src_dir/file1.txt"/>
          <file basedir="src_dir" file="src_dir/file2.txt"/>
        </resources>
  </copy>


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

DO NOT REPLY [Bug 45944] Bug using the file element as a nested element in the Copy task

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


Stefan Bodewig <bo...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |notifications@ant.apache.org
         AssignedTo|notifications@ant.apache.org|bodewig@apache.org
   Target Milestone|---                         |1.8.0




-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
You are the assignee for the bug.

DO NOT REPLY [Bug 45944] Bug using the file element as a nested element in the Copy task

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


Stefan Bodewig <bo...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|Core                        |Core tasks
         OS/Version|Linux                       |All




--- Comment #1 from Stefan Bodewig <bo...@apache.org>  2008-10-06 05:52:37 PST ---
The issue here is that a file resource represents an absolute path unless you
also set the basedir attribute.

If you don't specify a mapper, the identity-mapper will be used in order to
determine the target file name, which in the case of an absolute path is the
file itself.

If you change you example to either

  <copy todir="dest">
        <resources>
          <file basedir="src_dir" file="file1.txt"/>
          <file basedir="src_dir" file="file2.txt"/>
        </resources>
  </copy>

or

  <copy todir="dest" flatten="true">
        <resources>
          <file file="src_dir/file1.txt"/>
          <file file="src_dir/file2.txt"/>
        </resources>
  </copy>

it will copy the files.

I completely agree this is inconsistent with the docs, but I think the docs are
wrong and need to talk about resources returning absolute paths.  I don't
really know how <copy> is supposed to pick the target file names from our
examples - flatten seems both reasonable and arbitrary.

Before I go any further, I'm going to raise this on the dev list.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

DO NOT REPLY [Bug 45944] Bug using the file element as a nested element in the Copy task

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


Stefan Bodewig <bo...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
          Component|Core tasks                  |Documentation
         Resolution|                            |FIXED




--- Comment #4 from Stefan Bodewig <bo...@apache.org>  2008-10-09 04:29:33 PST ---
changed the documentation in trunk with svn revision 703136.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

DO NOT REPLY [Bug 45944] Bug using the file element as a nested element in the Copy task

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





--- Comment #3 from Stefan Bodewig <bo...@apache.org>  2008-10-06 09:21:02 PST ---
note that the example says flatten="true", so it is correct (but needs more
explanations).


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.