Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » package root setting
package root setting [message #291037] Tue, 06 September 2005 16:24 Go to next message
Eclipse UserFriend
Originally posted by: johan.elmstrom.edb.se

Hi all...

I've just installed eclipse, and I am having a slight problem with setting
up multiple projects from a shared
directory structure.

We are developing an application consisting of several modules in the same
suite, thise all share a root namespace, com.x.y.z. Under z there are
several modules that are autonomous.

I'd like to be able to open all of these in separate projects in eclipse,
since they have different imports and dependencies, but i am having
serious problems setting it up. When i create my 'CustomerModule'
project, and use the existing folder (CVS repository), the compiler
complains that the
package com.x.y.z is invalid and that my class should be defined in the
CustomerModule namespace.
I want to tell the compiler that even though these files appear to be in
the root directory, it should accept the 'com.x.y.z' prefix and compile
the
XCustomer.java file into com.x.y.z.CustomerModule.XCustomer.class
I haven't found any way to achieve this.

The reason i want to try and separate it like this is that we have
serverside modules in the same structure, and I really want them separated
in the
development environment, even though they are in the same CVS structure.

Is there a setting I have not discovered yet?
Is there a plugin available for this?


Appreciate any help


/Johan
Re: package root setting [message #291040 is a reply to message #291037] Tue, 06 September 2005 16:48 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sunil_kamath.nohotspammail.com

"Johan" <johan.elmstrom@edb.se> wrote in message
news:4a51106270ac5a7d2b478907f8137337$1@www.eclipse.org...
> Hi all...
>
> I've just installed eclipse, and I am having a slight problem with setting
> up multiple projects from a shared
> directory structure.
> We are developing an application consisting of several modules in the same
> suite, thise all share a root namespace, com.x.y.z. Under z there are
> several modules that are autonomous.
>[snip]
>
>
Do you want to diagram how the directory structure looks?
That may help in solving your problem.
---
Sunil
Re: package root setting [message #291056 is a reply to message #291040] Wed, 07 September 2005 07:03 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: johan.elmstrom.edb.se

No problem

CVS_SOURCE
|-com
| - x
| - y
| - z
| - ClientModule1
| - ClientModule2
| - ClientModule3
| - ServerModule1

I want to be able to set up a project for each of the modules, with unique
imports etc. But when i create a new project and specify its root
as'ClientModule1', the compiler complains about not being able to resolve
com.x.y.z.....
I would really _really_ like to avoid having the server and client modules
in the same project.

Thanks

/Johan
Re: package root setting [message #291066 is a reply to message #291056] Wed, 07 September 2005 10:39 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: automatic.javalobby.org

The problem is that 'com' needs to be at the root of the project, and not the individual packages.

So what you should end up with is:
CM1\com\x\y\z\ClientModule1
CM2\com\x\y\z\ClientModule2
CM3\com\x\y\z\ClientModule3
SM1\com\x\y\z\ServerModule1

You're trying to have them all in the same directory, which won't work ...
Re: package root setting [message #291067 is a reply to message #291056] Wed, 07 September 2005 12:29 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Johan wrote:
> No problem
>
> CVS_SOURCE
> |-com
> | - x | - y
> | - z
> | - ClientModule1
> | - ClientModule2
> | - ClientModule3
> | - ServerModule1
> I want to be able to set up a project for each of the
> modules, with unique imports etc. But when i create a new project and
> specify its root as'ClientModule1', the compiler complains about not
> being able to resolve com.x.y.z..... I would really _really_ like to
> avoid having the server and client modules in the same project.
>

A normal eclipse project is set up as:

<project>/src/com/a/pkg/module

where src is a designated source folder, and must contain your entire
package.

Some options for dealing with your setup:

1. bite the bullet, and move the directory structure into
eclipse-friendly projects. ex:

CM1/src/com/x/z/ClientModule1

CM2/src/com/x/z/ClientModule2

It looks a little odd, but it can help keep unwanted dependancies from
creeping into your source (since they would be REALLY obvious).

2. Create your projects,

CM1/src/com/x/z

and then link in the source from your common CVS tree. I'm not quite
sure how this works, though.

Later,
PW


Re: package root setting [message #291068 is a reply to message #291067] Wed, 07 September 2005 12:43 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: johan.elmstrom.edb.se

I think i will have to admit defeat here then, I haven't really found any
tool that can do what i want (it can't be that difficult).

It would have been really nice to keep it in a nice clean structure then
just point at the source.

Thaks for your help!

/Johan
Re: package root setting [message #291081 is a reply to message #291068] Wed, 07 September 2005 15:06 Go to previous message
Eclipse UserFriend
Originally posted by: eclipse3.rizzoweb.com

Johan wrote:
> I think i will have to admit defeat here then, I haven't really found
> any tool that can do what i want (it can't be that difficult).
>
> It would have been really nice to keep it in a nice clean structure then
> just point at the source.
>
> Thaks for your help!

Well, I think the problem and reason you haven't found a tool to do what
you want is because it is not what most people would call a "clean
structure."
You are thinking in the right way in terms of keeping client and server
modules separate, but you're trying to organize the source for the
different modules under one root, which doesn't jibe with keeping the
modules separate.

It is OK (and considered a good practice) to have multiple Projects with
multiple source roots, even if they share part of the package names in
common. For example, com.foo.common.* for shared or "common" code that
is used by all modules - that would be one project with one source root
in it. One of the client module's packages might be com.foo.client1.*
and would be a separate Project with its own source root.
This will not only make it easier to organize Eclipse projects, but also
make it easier to build the various modules separately (for example,
into separate JARs or WARs).

HTH,
Eric
Previous Topic:Dumb classpath problem with headless testing
Next Topic:Detecting external changes to a resource
Goto Forum:
  


Current Time: Sat Apr 27 04:42:16 GMT 2024

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

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

Back to the top