1

I have a project with a number of POM files. I have done a clean install and eclipse:eclipse. I would like to import the project as a normal project rather than Maven project. When I imported the project as normal project , I was not able to see the Maven dependencies present in POM in eclipse's build path. Is importing the project as Maven project only way of doing it? When I import the project as Maven project I see a number projects in eclipse workspace (one for each POM). However I would like to view this as a single project in eclipse workspace.

UPDATE: The classpath files of the child projects contain the dependent jar files , however it is not added to build path when the main project is added. Only the entries in classpath file of the main project is being added.

2
  • What version of Maven are you using? Also, when you saying "a number of POM files" do you mean you have a parent-child project model? Commented Apr 11, 2012 at 15:46
  • Hi Spencer, yes it is parent child model. I am using maven 2.2.1 Commented Apr 11, 2012 at 15:47

3 Answers 3

2

Given that you refer to "Maven project", are you using an eclipse plugin for Maven like M2Eclipse?

Assuming you are using M2Eclipse, the Maven Dependencies Library is automatically enabled for a Maven project. For a normal Java project, importing the library would force you to configure the project as a Maven project (On the context menu for the project, select Configure -> Convert to Maven Project).

Having said that, while you import your Maven project, you will notice an "Advanced" option (towards the lower section of the "Import Maven Projects" dialog). When you expand this option, there will be a checkbox to "Resolve Workspace Projects" - this is checked by default and is hence responsible for importing the child modules as separate projects. If you uncheck this, it will import only the parent module as the project and all children modules will be in sb folders under the parent module.

IMO, resolving the projects provides greater clarity, but then again this is very much a personal choice.

Hope that helps.

Sign up to request clarification or add additional context in comments.

2 Comments

Hi Neel, Thanks for your suggestion. I tried unchecking , but still all the projects are getting displayed.
Did you try re-importing afresh with the box unchecked?
1

Eclipse doesn't support nested projects, and Maven kinda forces you to. So you can't really push everything into one project.

Doing a cursory google search led me to this, which might be helpful: http://warpedjavaguy.wordpress.com/2011/08/08/how-i-defeated-the-maven-release-plugin-in-a-flat-structured-multi-module-project/

You might also check out the following two online books from Sonatype: Maven: The Complete Reference and Developing with Eclipse and Maven

1 Comment

Thanks Spencer. Thanks a lot for the links as well.
1

Personally, I create Working Sets for each multi-module project and add all the individual projects to it. This enables me to see them all grouped together, this might be to your liking.

http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Fconcepts%2Fcworkset.htm

Once you have created the working set you can enable/disable them in the menu in Project Explorer and configure the project explorer to display the working set as the root element in the tree rather than the project.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.