• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using a Maven2 Hierarchical Project Structure with Eclipse

 
Andrew Leer
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18212
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic