Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » getting build path to create package directories
getting build path to create package directories [message #8019] Wed, 19 January 2005 13:12 Go to next message
Eclipse UserFriend
Originally posted by: marc.esher.cablespeed.com

Greetings. New to eclipse and have what has to be a really easy problem to
solve.

I have a project whose file system structure is
[project]/src/AllFiles.java. So...all source files are listed in src, even
though they are different packages.

and then the build path is [project]/classes/

When we compile, we tell the compiler to build the output path based on
the packages, so that the output path might have
[project]/classes/com/blah/beans/
[project]/classes/com/blah/db/
[project]/classes/com/blah/andsoforth/

It's been this way for some time and has worked OK. Now, I want to give
eclipse a shot, but I'm having trouble getting it set up to compile the
files into the respective output paths based on package names. From what
I can tell, it looks like eclipse will only do that if my source folders
are set up by package names, and that's unlikely at this point.

So...is there a way to for me to keep my current source structure, but
still have eclipse build the files into package-specific directories?

Thanks.
Re: getting build path to create package directories [message #8144 is a reply to message #8019] Wed, 19 January 2005 16:00 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: daniel.megert.gmx.net

mde wrote:

> Greetings. New to eclipse and have what has to be a really easy
> problem to solve.
>
> I have a project whose file system structure is
> [project]/src/AllFiles.java. So...all source files are listed in src,
> even though they are different packages.
> and then the build path is [project]/classes/
>
> When we compile, we tell the compiler to build the output path based
> on the packages, so that the output path might have
> [project]/classes/com/blah/beans/
> [project]/classes/com/blah/db/
> [project]/classes/com/blah/andsoforth/
>
> It's been this way for some time and has worked OK. Now, I want to
> give eclipse a shot, but I'm having trouble getting it set up to
> compile the files into the respective output paths based on package
> names. From what I can tell, it looks like eclipse will only do that
> if my source folders are set up by package names, and that's unlikely
> at this point.
>
> So...is there a way to for me to keep my current source structure, but
> still have eclipse build the files into package-specific directories?

Eclipse supports packages that are stored according to JLS2 7.2.1. If
you put all your files into one directory the built-in compiler will not
work and with it most of the coding features.

Dani

>
> Thanks.
>
Re: getting build path to create package directories [message #8429 is a reply to message #8144] Wed, 19 January 2005 22:46 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: marc.esher.cablespeed.com

Thanks for responding, Daniel. So...I've got to create a source directory
structure like so:

/src/com/blah/blah/db
/src/com/blah/blah/beans

and so forth, correct?

Daniel Megert wrote:

> mde wrote:

>> Greetings. New to eclipse and have what has to be a really easy
>> problem to solve.
>>
>> I have a project whose file system structure is
>> [project]/src/AllFiles.java. So...all source files are listed in src,
>> even though they are different packages.
>> and then the build path is [project]/classes/
>>
>> When we compile, we tell the compiler to build the output path based
>> on the packages, so that the output path might have
>> [project]/classes/com/blah/beans/
>> [project]/classes/com/blah/db/
>> [project]/classes/com/blah/andsoforth/
>>
>> It's been this way for some time and has worked OK. Now, I want to
>> give eclipse a shot, but I'm having trouble getting it set up to
>> compile the files into the respective output paths based on package
>> names. From what I can tell, it looks like eclipse will only do that
>> if my source folders are set up by package names, and that's unlikely
>> at this point.
>>
>> So...is there a way to for me to keep my current source structure, but
>> still have eclipse build the files into package-specific directories?

> Eclipse supports packages that are stored according to JLS2 7.2.1. If
> you put all your files into one directory the built-in compiler will not
> work and with it most of the coding features.

> Dani

>>
>> Thanks.
>>
Re: getting build path to create package directories [message #8550 is a reply to message #8429] Thu, 20 January 2005 08:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: daniel.megert.gmx.net

mde wrote:

> Thanks for responding, Daniel. So...I've got to create a source
> directory structure like so:
>
> /src/com/blah/blah/db
> /src/com/blah/blah/beans
>
> and so forth, correct?

Yes. For more info I suggest to read the JLS2 7.2.1 which explains it in
detail.

Dani

>
> Daniel Megert wrote:
>
>> mde wrote:
>
>
>>> Greetings. New to eclipse and have what has to be a really easy
>>> problem to solve.
>>>
>>> I have a project whose file system structure is
>>> [project]/src/AllFiles.java. So...all source files are listed in
>>> src, even though they are different packages.
>>> and then the build path is [project]/classes/
>>>
>>> When we compile, we tell the compiler to build the output path based
>>> on the packages, so that the output path might have
>>> [project]/classes/com/blah/beans/
>>> [project]/classes/com/blah/db/
>>> [project]/classes/com/blah/andsoforth/
>>>
>>> It's been this way for some time and has worked OK. Now, I want to
>>> give eclipse a shot, but I'm having trouble getting it set up to
>>> compile the files into the respective output paths based on package
>>> names. From what I can tell, it looks like eclipse will only do
>>> that if my source folders are set up by package names, and that's
>>> unlikely at this point.
>>>
>>> So...is there a way to for me to keep my current source structure,
>>> but still have eclipse build the files into package-specific
>>> directories?
>>
>
>> Eclipse supports packages that are stored according to JLS2 7.2.1. If
>> you put all your files into one directory the built-in compiler will
>> not work and with it most of the coding features.
>
>
>> Dani
>
>
>>>
>>> Thanks.
>>>
>
>
Re: getting build path to create package directories [message #9731 is a reply to message #8550] Thu, 20 January 2005 12:10 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: marc.esher.cablespeed.com

Thanks Daniel. That did the trick.

Daniel Megert wrote:

> mde wrote:

>> Thanks for responding, Daniel. So...I've got to create a source
>> directory structure like so:
>>
>> /src/com/blah/blah/db
>> /src/com/blah/blah/beans
>>
>> and so forth, correct?

> Yes. For more info I suggest to read the JLS2 7.2.1 which explains it in
> detail.

> Dani

>>
>> Daniel Megert wrote:
>>
>>> mde wrote:
>>
>>
>>>> Greetings. New to eclipse and have what has to be a really easy
>>>> problem to solve.
>>>>
>>>> I have a project whose file system structure is
>>>> [project]/src/AllFiles.java. So...all source files are listed in
>>>> src, even though they are different packages.
>>>> and then the build path is [project]/classes/
>>>>
>>>> When we compile, we tell the compiler to build the output path based
>>>> on the packages, so that the output path might have
>>>> [project]/classes/com/blah/beans/
>>>> [project]/classes/com/blah/db/
>>>> [project]/classes/com/blah/andsoforth/
>>>>
>>>> It's been this way for some time and has worked OK. Now, I want to
>>>> give eclipse a shot, but I'm having trouble getting it set up to
>>>> compile the files into the respective output paths based on package
>>>> names. From what I can tell, it looks like eclipse will only do
>>>> that if my source folders are set up by package names, and that's
>>>> unlikely at this point.
>>>>
>>>> So...is there a way to for me to keep my current source structure,
>>>> but still have eclipse build the files into package-specific
>>>> directories?
>>>
>>
>>> Eclipse supports packages that are stored according to JLS2 7.2.1. If
>>> you put all your files into one directory the built-in compiler will
>>> not work and with it most of the coding features.
>>
>>
>>> Dani
>>
>>
>>>>
>>>> Thanks.
>>>>
>>
>>
Re: getting build path to create package directories [message #112413 is a reply to message #9731] Wed, 26 October 2005 19:34 Go to previous message
Eclipse UserFriend
Originally posted by: mdos.verizon.net

Hello Dani (and all):

I've got a similar issue, but at the opposite end of the spectrum.
An existing project of significant size is broken down into eclipse
projects, and has the following directory structure:

basedir/
com.myco.myproject1/src/com/myco/mypackage1/*.java
/bin/com/myco/mypackage1/*.class
com.myco.myproject2/src/com/myco/mypackage2/*.java
/bin/com/myco/mypackage2/*.class
com.myco.myproject3/src/com/myco/mypackage3/*.java
/bin/com/myco/mypackage3/*.class
com.myco.myproject4/src/com/myco/mypackage4/*.java
/bin/com/myco/mypackage4/*.class
.. and so on

All the code gets packaged up into a single jar. I believe the team
is currently generating the jar from within eclipse by using the jar
tool and 'checking off' which projects they want included in the jar.

We're using project dependencies in eclipse to build everything. I
guess the original developers felt that this structure kept the
different parts of the project neatly isolated. It makes things much
harder when attempting to jar up a release with ant, though.

JLS3 7.2.1 states that: "As an extremely simple example, all packages
and source and binary code on a system *might* be stored in a single
directory and its subdirectories." This wording seems more like a
potential example, or perhaps a suggestion, than a requirement. Does
the compiler and jar tool expect this layout?

Should I recommend that the team put forth the effort of consolidating
all our projects under a single project directory like this:

basedir/
src/com/myco/mypackage1/*.java
/mypackage2/*.java
/mypackage3/*.java
/mypackage4/*.java
bin/com/myco/mypackage1/*.class
/mypackage2/*.class
/mypackage2/*.class
/mypackage3/*.class
/mypackage4/*.class

It seems more 'standards conforming', but will be a bit of an effort
given the size of the project.

Is there some way to maintain the current directory layout and build the
jar with ant, or should I push for the layout change? Is it worth it?

Thanks.

-Marc

mde wrote:
> Thanks Daniel. That did the trick.
> Daniel Megert wrote:
>
>> mde wrote:
>
>
>>> Thanks for responding, Daniel. So...I've got to create a source
>>> directory structure like so:
>>>
>>> /src/com/blah/blah/db
>>> /src/com/blah/blah/beans
>>>
>>> and so forth, correct?
>
>
>> Yes. For more info I suggest to read the JLS2 7.2.1 which explains it
>> in detail.
>
>
>> Dani
>
>
>>>
>>> Daniel Megert wrote:
>>>
>>>> mde wrote:
>>>
>>>
>>>
>>>>> Greetings. New to eclipse and have what has to be a really easy
>>>>> problem to solve.
>>>>>
>>>>> I have a project whose file system structure is
>>>>> [project]/src/AllFiles.java. So...all source files are listed in
>>>>> src, even though they are different packages.
>>>>> and then the build path is [project]/classes/
>>>>>
>>>>> When we compile, we tell the compiler to build the output path
>>>>> based on the packages, so that the output path might have
>>>>> [project]/classes/com/blah/beans/
>>>>> [project]/classes/com/blah/db/
>>>>> [project]/classes/com/blah/andsoforth/
>>>>>
>>>>> It's been this way for some time and has worked OK. Now, I want to
>>>>> give eclipse a shot, but I'm having trouble getting it set up to
>>>>> compile the files into the respective output paths based on package
>>>>> names. From what I can tell, it looks like eclipse will only do
>>>>> that if my source folders are set up by package names, and that's
>>>>> unlikely at this point.
>>>>>
>>>>> So...is there a way to for me to keep my current source structure,
>>>>> but still have eclipse build the files into package-specific
>>>>> directories?
>>>>
>>>>
>>>
>>>> Eclipse supports packages that are stored according to JLS2 7.2.1.
>>>> If you put all your files into one directory the built-in compiler
>>>> will not work and with it most of the coding features.
>>>
>>>
>>>
>>>> Dani
>>>
>>>
>>>
>>>>>
>>>>> Thanks.
>>>>>
>>>
>>>
>
>
Previous Topic:Excluding sources from the build?
Next Topic:Setting up a Local update site
Goto Forum:
  


Current Time: Sun Oct 06 15:19:34 GMT 2024

Powered by FUDForum. Page generated in 0.06738 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top