You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Steve Loughran <st...@apache.org> on 2007/02/12 14:55:55 UTC

Eclipse, and and

I've been playing with Ant under netbeans and eclipse this weekend, as 
the final bit of work for the forthcoming Ant in Action book.

Netbeans 6.0m6 is pretty nice, ant1.7.0 is in there already, etc,etc. 
But eclipse, well, it seems to have problems with build files that use 
<import>

It seems to me that once you create an eclipse project from an existing 
build file, it copies over your build.xml to its workspace, and when it 
runs, <import> doesnt pick up any imported files, as the build file has 
been moved -even though in the run the basedir property is set to the 
original base dir.

Who else has encountered this? Is it a serious problem?

If it is, I could probably put a patch in to Ant1.7.1 to make it 
possible to include basedir relative filename lookup during imports, 
something like basedir attribute which takes values of "first", "last", 
"only", "never", and the task would look in basedir/ for the file first, 
last only or never. With a default of last, all existing build files 
would work under eclipse.

If its not that serious a problem, I wont bother with this, but if it is 
an issue, then we can certainly tweak ant so it runs under eclipse better

-steve

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


Re: Eclipse, and and

Posted by Dominique Devienne <dd...@gmail.com>.
> they resolve other imports relative to their own location, but all other
> files are relative to whatever imported them. Its because <import> is
> different that things break.

Doesn't that contradicts what you say below? Import does not resolve
relative to its "own location" (i.e. the location of the build file
doing the import), but relative to the basedir forced on it from the
top-level "importer". I actually advocated the first behavior, but the
second one is what's implemented.

And AFAIK, the basedir "forced" on the imported build file is used to
resolve all file/location rel. paths, not just the imports, no?

> For normal imports you can extract the base dir of the imported file by
> relying on it is ant.project.myname property being set and working it out...

Yes, I know, and I don't like it ;-) --DD

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


Re: Eclipse, and and

Posted by Steve Loughran <st...@apache.org>.
Dominique Devienne wrote:
>> > The simple fix is to use ${basedir} explicitly in the <import>, no?
>>
>> breaks chaining though, doesnt it?
> 
> Well, sure, but only because the basedir needs to be explicit since
> the build file was moved.
> 
> And don't get me started on the fact the imported-builds resolve their
> own imports (or all file locations) relative to the importer! ;-) I
> think this is a terrible flaw of import, as I screamed since the
> beginning ;-))) --DD

they resolve other imports relative to their own location, but all other 
files are relative to whatever imported them. Its because <import> is 
different that things break.

For normal imports you can extract the base dir of the imported file by 
relying on it is ant.project.myname property being set and working it out...

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


Re: Eclipse, and and

Posted by Dominique Devienne <dd...@gmail.com>.
> > The simple fix is to use ${basedir} explicitly in the <import>, no?
>
> breaks chaining though, doesnt it?

Well, sure, but only because the basedir needs to be explicit since
the build file was moved.

And don't get me started on the fact the imported-builds resolve their
own imports (or all file locations) relative to the importer! ;-) I
think this is a terrible flaw of import, as I screamed since the
beginning ;-))) --DD

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


Re: Eclipse, and and

Posted by Steve Loughran <st...@apache.org>.
Dominique Devienne wrote:
> On 2/12/07, Steve Loughran <st...@apache.org> wrote:
>> Netbeans 6.0m6 is pretty nice, ant1.7.0 is in there already, etc,etc.
>> But eclipse, well, it seems to have problems with build files that use
>> <import>
>>
>> It seems to me that once you create an eclipse project from an existing
>> build file, it copies over your build.xml to its workspace, and when it
>> runs, <import> doesnt pick up any imported files, as the build file has
>> been moved -even though in the run the basedir property is set to the
>> original base dir.
>>
>> Who else has encountered this? Is it a serious problem?
> 
> Is it not more of an Eclipse issue?
> 
> The simple fix is to use ${basedir} explicitly in the <import>, no?

breaks chaining though, doesnt it?

> Adding ways to resolve or not (and in what order) relative filenames
> against the basedir seems a bit much to me, and kinda opens a new can
> of worms I'd prefer us not to get into. i.e. I'd prefere to keep it
> simple, with the ${basedir} fix above. --DD
> 
> ---------------------------------------------------------------------
> 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: Eclipse, and and

Posted by Dominique Devienne <dd...@gmail.com>.
On 2/12/07, Steve Loughran <st...@apache.org> wrote:
> Netbeans 6.0m6 is pretty nice, ant1.7.0 is in there already, etc,etc.
> But eclipse, well, it seems to have problems with build files that use
> <import>
>
> It seems to me that once you create an eclipse project from an existing
> build file, it copies over your build.xml to its workspace, and when it
> runs, <import> doesnt pick up any imported files, as the build file has
> been moved -even though in the run the basedir property is set to the
> original base dir.
>
> Who else has encountered this? Is it a serious problem?

Is it not more of an Eclipse issue?

The simple fix is to use ${basedir} explicitly in the <import>, no?
Adding ways to resolve or not (and in what order) relative filenames
against the basedir seems a bit much to me, and kinda opens a new can
of worms I'd prefer us not to get into. i.e. I'd prefere to keep it
simple, with the ${basedir} fix above. --DD

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