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 2015/03/17 10:27:51 UTC

[Bug 57719] New: Mapper classes should be loaded with ComponentHelper

https://bz.apache.org/bugzilla/show_bug.cgi?id=57719

            Bug ID: 57719
           Summary: Mapper classes should be loaded with ComponentHelper
           Product: Ant
           Version: 1.9.4
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core tasks
          Assignee: notifications@ant.apache.org
          Reporter: chuchiperriman@gmail.com

All tasks are loaded with ComponentHelper but Mapper doesn't. In our
environment we hack some classpath (and more things) when load the tasks but
the mapper task is not loaded by the componente helper, the Tasks are creating
the object (Copy task, MappingSelector, MappedResourceCollection, etc)

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

[Bug 57719] Mapper classes should be loaded with ComponentHelper

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

--- Comment #1 from Stefan Bodewig <bo...@apache.org> ---
This applies to all nested elements of tasks that are using the createXYZ()
method rather than the addXYZ() variant.  This means in order to change this
we'd need to modify all Ant tasks using create(), which is certainly possible
for Ant's own tasks but not for third party tasks.

The "create" variant is there so that tasks can have full control over the
classloader they use.  I don't think this applies to the Mapper case so it may
be possible to replace create with add - but that would be breaking API
backwards compatibility.

Are you using the <mapper class="xxxx"/> way of specifying the mapper?  If your
class implements FileNameMapper you should be able to typedef it and add it to
copy directly (since it also contains an add method for FileNameMapper) and use
the core loader.  This would also work for all other tasks supporting mappers
since <mapper> itself has an add method for FileNameMapper.

So rather than

<copy>
  <mapper classname="foo.bar.Mapper"/>
</copy>

you'd use

<typedef name="mymapper" classname="foo.bar.Mapper"/>
<copy>
  <mymapper/>
</copy>

or 

<typedef name="mymapper" classname="foo.bar.Mapper"/>
<copy>
  <mapper>
    <mymapper/>
  </mapper>
</copy>

and should be able to control the classloader used for the typedef.

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