Bug 53244 - Add "useDestinationBasedir" to import task
Summary: Add "useDestinationBasedir" to import task
Status: NEW
Alias: None
Product: Ant
Classification: Unclassified
Component: Core tasks (show other bugs)
Version: unspecified
Hardware: PC All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: Ant Notifications List
Depends on:
Reported: 2012-05-16 15:50 UTC by Tobias Bertelsen
Modified: 2012-06-09 17:58 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Bertelsen 2012-05-16 15:50:14 UTC
When using the import task, users are forced to changed all paths in the imported file, so they are based on ${imported.basedir} instead of just the normal basedir.  See: http://ant.apache.org/manual/Tasks/import.html

This is extremely cumbersome when one want's to reuse existing ant code 

A attribute to the import task below would solve this problem. When set to true, the imported ant file would be resolved using it's default basedir, instead of that of the importing file. It would naturally be optional and default to false, so it won't break any compability. 

<import file="path/to/other/build.xml" useDestinationBasedir="true"/>
Comment 1 Stefan Bodewig 2012-06-09 17:58:26 UTC
While I understand the desire this isn't terribly easy to implement.

The way import works the imported targets and tasks become part of the importing build file.  At the point in time where the tasks get executed (and attributes expanded) the tasks don't "know" they've been part of a different build file.