wood burning stoves 2.0*
The moose likes Ant, Maven and Other Build Tools and the fly likes Using a Maven2 Hierarchical Project Structure with Eclipse Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Using a Maven2 Hierarchical Project Structure with Eclipse" Watch "Using a Maven2 Hierarchical Project Structure with Eclipse" New topic
Author

Using a Maven2 Hierarchical Project Structure with Eclipse

Andrew Leer
Ranch Hand

Joined: Nov 11, 2003
Posts: 44
Hi,
I was wondering if it's possible, or if the two technologies are in-compatible, to use a Maven2 Hierarchical project structure (with nested projects and pom.xml files) in eclipse, without constantly switching workspaces.

I noticed that in Package Explorer in Eclipse there is an option on the dropdown menu to the far left of Package Explorer (brought up by clicking a little white triangle pointed down), Layout->Hierarchical which would seem to support this, but when I try to copy one mavenized eclipse project inside another it does not seem to allow me to do this (inside eclipse anyway).

So what would the correct proceedure be for achieving this? Or is it just a matter of switching workspaces? (or for that matter just waiting for Eclipse 4.0?)

Thanks,
I hope I was clear enough,
- Andy
Dave Tuttle
Ranch Hand

Joined: Jan 18, 2006
Posts: 34
Hi Andy,
As I recall, eclipse can't do nested projects. I had the same issue.
You can create one eclipse project for all your maven projects or one eclipse project for each bottom-level maven project.
Switching workspaces isn't good because many of your settings are workspace-specific.
--Dave
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019
    
  20

Well, ultimately, an Eclipse project maps fairly well to a CVS project, so many of the same issues apply in CVS as well.

If I have any comprehesion of Maven 2 (which is admittedly questionable), a simple resource copy-and-paste could clone subprojects from one Maven superproject (Eclipse Project) to anaother. You could as easily do that using the Windows Explorer if you didn't have CVS files that would be impacted.

However, failing better solutions, you might find working in large Maven projects more tolerable if you use the "Working Set" feature on the Navigator. You can make each subproject of interest into a Working Set and switch between them, thus limiting the amount of clutter. I also do this for entire projects sometimes.

Of course, if you're cloning a Maven subproject from one major project to another, the question is: shouldn't that subproject become a standalone project in its own right? After all, one of Maven's strengths is the ability to fetch prebuilt jars as needed. Why replicate things? -- Unless you're doing per-project code customization.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
 
subject: Using a Maven2 Hierarchical Project Structure with Eclipse