Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Sub-Projects in eclipse
Sub-Projects in eclipse [message #261998] Sun, 27 July 2008 22:54 Go to next message
Eclipse UserFriend
Originally posted by: mark.macumber.gmail.com

Hi All,

I was wondering if anyone knows of a feature in eclipse (or possibly an
existing plug-in) where you can arrange projects as sub-projects of a
project.

Currently I am working with a Maven project where it has MANY sub-modules,
this appears very cluttered and hard to work with as they are all
displayed as separate projects on a flat level.

It would be great to arrange my sub-projects INTO the main project (with
all normal project options, like close and open, etc...) so that it would
be all encapsulated.

Anyone heard of anything like this?

Thanks!
Re: Sub-Projects in eclipse [message #262003 is a reply to message #261998] Sun, 27 July 2008 22:55 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: zx.code9.com

Mark wrote:
> Hi All,
>
> I was wondering if anyone knows of a feature in eclipse (or possibly an
> existing plug-in) where you can arrange projects as sub-projects of a
> project.
>
> Currently I am working with a Maven project where it has MANY
> sub-modules, this appears very cluttered and hard to work with as they
> are all displayed as separate projects on a flat level.
> It would be great to arrange my sub-projects INTO the main project (with
> all normal project options, like close and open, etc...) so that it
> would be all encapsulated.
>
> Anyone heard of anything like this?

Eclipse doesn't really have sub-projects, but you can use the concept of
working sets to help reduce the visual clutter:

http://wbeaton.blogspot.com/2005/11/leanin-on-working-sets.h tml
http://live.eclipse.org/node/489

Cheers,

~ Chris
Re: Sub-Projects in eclipse [message #262005 is a reply to message #262003] Sun, 27 July 2008 23:09 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mark.macumber.gmail.com

Thank you for the speedy reply, working sets sounds like a nice way to
clear the clutter. But I really think that (and maybe this is more of a
Maven plugin suggestion) a sub-project based view could be a nice way to
go in the future, what do you think?
Re: Sub-Projects in eclipse [message #262007 is a reply to message #262005] Sun, 27 July 2008 23:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: codeslave.ca.ibm.com

I use nested projects like this:

/root_project/
/root_project/plugins/
/root_project/plugins/org.eclipse.foo/
/root_project/plugins/org.eclipse.bar/
/root_project/features/
/root_project/features/org.eclipse.foo-feature/
/root_project/features/org.eclipse.bar-feature/
/root_project/tests/
/root_project/tests/org.eclipse.foo.tests/

Then, I check the top-level project (/root_project/) out of CVS, so I
can see the whole tree as a single project.

Once that project is available, I can use Import > Existing projects to
create pointers (new projects in the workspace) to those nested projects.

The benefit here is that I can do a full cvs update / disk refresh /
search from a single folder (the top project), and I can also have the
nested projects as real projects in Eclipse (eg., feature projects
behave like feature projects; plugin projects behave like plugin
projects; java projects work like java projects).

The only negative side effect to this is that the root project and its
imported children tend to get out of synch, and you'll see the same
changed file listed in the Synch view twice. But it's easy to simply
refresh one or the other project (root or child) to make the dupes
vanish and get everything re-synched. This only happens when you have a
big workspace or when you have auto-refresh turned off for performance
reasons.


Mark wrote:
> Thank you for the speedy reply, working sets sounds like a nice way to
> clear the clutter. But I really think that (and maybe this is more of a
> Maven plugin suggestion) a sub-project based view could be a nice way to
> go in the future, what do you think?
>

--
Nick Boldt :: Release Engineer, IBM Toronto Lab
Eclipse Modeling :: http://www.eclipse.org/modeling
http://wiki.eclipse.org/index.php/User:Nickb
Re: Sub-Projects in eclipse [message #262059 is a reply to message #262007] Sun, 27 July 2008 23:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mark.macumber.gmail.com

Hmmm, well thats sort of what I had in mind too, but I could not get it to
work.

When I checked out the project from SVN (again, keeping in mind it was a
Maven 2 project), I had the project structure like this:

root/
root/src/main/java

root/modules

root/modules/module1
root/modules/module1/src/main/java

root/modules/module2
root/modules/module2/src/main/java

root/modules/module3
root/modules/module2/src/main/java
etc...

And when I tried to open a .JAVA file in one of the sub-modules and tried
a "call hierarchy", I had Eclipse tell me that the project was not on the
build path...

So I on module 1 (for example) I right-clicked and went to the properties
of the folder, but it had NONE of the normal build-path options available
to me.

Just 3 menu options (on the left):
"Resource"
"Run/Debug Settings"
"Subversion"

No "Java Build Path" or anything...

Even on the root, I only had:
"Resource"
"Builders"
"Project References"
"Run/Debug Settings"
"Subversion"
"Task Repository"
"Validation"

Any thoughts on how to make this work properly?

Also, just an FYI I can go to the SVN repos and "Check out as Maven
Project" but that results in the flat, layout that I wanted to avoid...

Thanks!
Re: Sub-Projects in eclipse [message #262060 is a reply to message #262059] Mon, 28 July 2008 00:13 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: codeslave.ca.ibm.com

Mark wrote:
> root/modules/module1
> root/modules/module1/src/main/java
> And when I tried to open a .JAVA file in one of the sub-modules and
> tried a "call hierarchy", I had Eclipse tell me that the project was not
> on the build path...

You need to import the folder module1 as a project in its own right,
which means it needs its own .project file
(root/modules/module1/.project). This file tells Eclipse not only what
to call the project when it imports it (eg., "module1") but also what
type of nature & builder to use (plugin, feature, java, php, c/c++,
etc.). Natures and Builders control how Eclipse will edit files in that
project and how it will compile them & resolve classpaths /
dependencies, etc.

If you don't already have that file in place, you can have Eclipse
generate you one by simply creating an empty project of the type you
require (New > Project > ...), then switching to the Navigator view, and
copying the newly generated .project file into your module1 folder. Once
there, edit the project name so it matches what you want.

THEN... do Import > existing project > and browse for the
root/modules/module1 folder.

Good luck!

--
Nick Boldt :: Release Engineer, IBM Toronto Lab
Eclipse Modeling :: http://www.eclipse.org/modeling
http://wiki.eclipse.org/index.php/User:Nickb
Re: Sub-Projects in eclipse [message #262062 is a reply to message #262060] Mon, 28 July 2008 01:18 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mark.macumber.gmail.com

Nick Boldt wrote:

> You need to import the folder module1 as a project in its own right,
> which means it needs its own .project file
> (root/modules/module1/.project). This file tells Eclipse not only what
> to call the project when it imports it (eg., "module1") but also what
> type of nature & builder to use (plugin, feature, java, php, c/c++,
> etc.). Natures and Builders control how Eclipse will edit files in that
> project and how it will compile them & resolve classpaths /
> dependencies, etc.

I see, this is what I wasn't too sure on, thanks!

> If you don't already have that file in place, you can have Eclipse
> generate you one by simply creating an empty project of the type you
> require (New > Project > ...), then switching to the Navigator view, and
> copying the newly generated .project file into your module1 folder. Once
> there, edit the project name so it matches what you want.

Luckily, maven can generate one for me using the mvn eclipse:eclipse
command. I did this on each sub-module, which generated the .project file
nicely.


> THEN... do Import > existing project > and browse for the
> root/modules/module1 folder.

This is where the problem occurred, when I went -> Import -> Existing
Project I selected the first module1, it imported it fine, but it was not
UNDER the root project, rather as a separate project in the workspace...

> Good luck!

Did what I say make sense?

Thanks for the help! Its greatly appreciated
Re: Sub-Projects in eclipse [message #262093 is a reply to message #262062] Mon, 28 July 2008 13:59 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: codeslave.ca.ibm.com

>> THEN... do Import > existing project > and browse for the
>> root/modules/module1 folder.
>
> This is where the problem occurred, when I went -> Import -> Existing
> Project I selected the first module1, it imported it fine, but it was
> not UNDER the root project, rather as a separate project in the
> workspace...

Yes, that's exactly right. So... what's the problem, then?

Eclipse can only determine project natures/builders for top-level
projects, so by importing child folders as top-level projects, you can
now get the best of both worlds.

And you can group things with Working Sets if you want to reduce the
clutter in the workspace. Or close the root project and hide it from the
Package Explorer, if you don't need it open.

--
Nick Boldt :: Release Engineer, IBM Toronto Lab
Eclipse Modeling :: http://www.eclipse.org/modeling
http://wiki.eclipse.org/index.php/User:Nickb
Re: Sub-Projects in eclipse [message #262125 is a reply to message #262093] Mon, 28 July 2008 22:34 Go to previous message
Eclipse UserFriend
Originally posted by: mark.macumber.gmail.com

I see, so working sets are the way to go the clean up the clutter... I
was, for some reason, under the impression that your first comment meant
that I could have sub-projects stored under the root project from within
eclipse.
Previous Topic:Background indexer consuming all available CPU and/or RAM
Next Topic:Need help using 'adapt' in core expression
Goto Forum:
  


Current Time: Fri Nov 28 22:06:51 GMT 2014

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

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