Announcement Announcement Module
No announcement yet.
Maven Nested Project in STS Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Maven Nested Project in STS

    This is probably a pretty noob problem, but I couldn't find a thread while searching, and I don't see anything while searching so here goes.

    How does one setup Maven child projects in Spring Tool Suite. I have a project called CAAOS I've been working on, and there are there are currently 3 main parts. One project called 'common' contains all the domain objects, and their JPA annotation and configurations. Another sub-project called 'server' is going to send, receive, and manipulate these domain objects. The 'server' project is going to be able to receive domain in the 'common' project via SOAP, REST, or JMS, and persist them, you know, like a normal web server. The other project, called 'client' is going to be able to communicate with the server, locally persist the domain objects from the 'common' project, and send them to the 'server' sub-project. All of these sub-projects are supposed to exist under a main project, called CAAOS, which doesn't really have much Java code, but it does have a pom.xml which defines global properties, and dependencies, and defines the children.

    So, on disk and in source control, the project should look like:

    ~/workspace/caaos/pom.xml (Parent Project)
    ~/workspace/caaos/common/pom.xml (common Project)
    ~/workspace/caaos/server/pom.xml (server Project)
    ~/workspace/caaos/client/pom.xml (client project)

    However, Spring Source Tool Suite didn't do things this way. I setup the projects, and even though I told the Maven Project setup wizard which projects where parents, and which were children, it made the whole thing flat:

    ~/workspace/caaos/pom.xml (Parent Project)
    ~/workspace/common/pom.xml (Common Project)
    ~/workspace/server/pom.xml (Server Project)
    ~/workspace/client/pom.xml (Client Project)

    This doesn't jive well with how Maven expects things to be setup. I've got to the fudge the POMs to tell each child where it's parent is, and I haven't been able to fudge the parent POM to tell it where it's children are. Furthermore, source control really does not like this setup.

    How do I refactor this project so it's setup on disk the way Maven expects it to be, but it still show up as separate projects within STS?

  • #2

    I am not a Maven expert, but what happens if you setup your projects on disc and then import them as Maven projects into STS/Eclipse?

    Another good resource to ask this question might be the Eclipse m2e users list here:

    They implement the Maven integration and might know more about this.