Why directory structure is enforced? [message #188514] |
Fri, 03 December 2004 17:34  |
Eclipse User |
|
|
|
Hi! Here's the problem. I'm writing code that belongs to the package, say,
"com.company.project.util".
And I want to keep this code in CVS directory, say,
/src/project/util/java. And I want to put all .java files right there in
this directory, without that nested directory tree
"com/company/project/util".
Eclipse doesn't like that. It gives me the error "The declared package
does not match the expected package com.company.project.util".
IS there any way to fix that? Do Eclipse developers plan to allow
arbitrary source paths?
Thanks
Andrew
|
|
|
|
|
Re: Why directory structure is enforced? [message #188562 is a reply to message #188555] |
Sat, 04 December 2004 22:09   |
Eclipse User |
|
|
|
Originally posted by: varavamu.yahoo.com
hi Guillaume,
yes - you are correct in that when using the 'javac' command-line tool, all your
sources could be located in same directory. But, afaik, physically separating
them based on the package structure allows for lot easier maintenance. Eclipse
just enforces this as a rule.
HTH,
Vijay
Guillaume Pothier wrote:
> It seems to me that java works like it for class files, not for source
> files. If I remember well the time when I used javac and a plain text
> editor, my source files could all be in the same directory but belong to
> different packages.
>
> Alex Fitzpatrick wrote:
>
>> Andrew wrote:
>>
>>> Hi! Here's the problem. I'm writing code that belongs to the package,
>>> say, "com.company.project.util".
>>>
>>> And I want to keep this code in CVS directory, say,
>>> /src/project/util/java. And I want to put all .java files right there
>>> in this directory, without that nested directory tree
>>> "com/company/project/util".
>>>
>>> Eclipse doesn't like that. It gives me the error "The declared
>>> package does not match the expected package com.company.project.util".
>>>
>>> IS there any way to fix that? Do Eclipse developers plan to allow
>>> arbitrary source paths?
>>
>>
>>
>> It's worked like this in Java since version 1. (Of Java!)
>>
>> Get used to it.
>>
|
|
|
Re: Why directory structure is enforced? [message #188576 is a reply to message #188555] |
Sun, 05 December 2004 15:40  |
Eclipse User |
|
|
|
Originally posted by: not_real.not_real.com
This is not entirely true. In order for javac to be able to
automatically find and compile other java classes that a file depends
on, it relies on a sourcepath directory structure that matches the
package structure.
Guillaume Pothier wrote:
> It seems to me that java works like it for class files, not for source
> files. If I remember well the time when I used javac and a plain text
> editor, my source files could all be in the same directory but belong to
> different packages.
>
> Alex Fitzpatrick wrote:
>
>> Andrew wrote:
>>
>>> Hi! Here's the problem. I'm writing code that belongs to the package,
>>> say, "com.company.project.util".
>>>
>>> And I want to keep this code in CVS directory, say,
>>> /src/project/util/java. And I want to put all .java files right there
>>> in this directory, without that nested directory tree
>>> "com/company/project/util".
>>>
>>> Eclipse doesn't like that. It gives me the error "The declared
>>> package does not match the expected package com.company.project.util".
>>>
>>> IS there any way to fix that? Do Eclipse developers plan to allow
>>> arbitrary source paths?
>>
>>
>>
>> It's worked like this in Java since version 1. (Of Java!)
>>
>> Get used to it.
>>
|
|
|
Powered by
FUDForum. Page generated in 0.03007 seconds