aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Parent with multi module 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 "Parent with multi module" Watch "Parent with multi module" New topic
Author

Parent with multi module

mark smith
Ranch Hand

Joined: Apr 05, 2005
Posts: 250
hi

i try to improve my knowledge on maven.

i would like to create a parent pom and some module (webapp, service, dao).

i use java 7, spring and netbeans.

my parent pom


nikela-webapps pom


nikela-service pom


when i try to build nikela-service



similar error for others modules and pom

all project is in: /home/collinm/dev/NetBeansProjects/

i tried to put



in parent section of my module, i get same error.

any idea?
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5843
    
    7

First you need to understand that there are two hierarchy mechanism in Maven: master module - submodule, and parent - child. These are independent concepts - it is not required that you use both simultaneously, like you have done.

I strongly recommend that that your master POM not be the parent POM for any of your submodules. The parent of a child module should reflect the type of module being build. For example, I define parent modules for building JARs, and other for WARs, and another for applications where I need to package the while thing up in a zip. These parent POMs in turn use a common parent POM that contains general things I require of all builds (compiler versions, reports, logging, etc), and that POM in turn has a parent POM used by my organization that defines other standards used by applications in our company (repository location, licensing, etc). The free PDF Maven: the Complete Reference has a good explanation of the differences between the two hierarchy type.

And one final word: I strongly recommend that you not use the "master module - submodule" relationship unless there is no other way to accomplish what you need. I have found that by using a continuous integration server, such as Jenkins, that is very rare to require the use of the "master module - submodule" relationship. In addition, the projects at work who ignored my advice and used a "master module - submodule" relationship anyway are constantly having issues that none of the other projects have.

JBoss In Action
mark smith
Ranch Hand

Joined: Apr 05, 2005
Posts: 250
thanks for the info

i thought i used paren / child structure
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5843
    
    7

Having a <submodules> in your pom means you are using the master/submodule hierarchy. The POM containing the section is the master, the ones reference are the submodules.

Having a <parent> section in you pom means you are using the parent/child relationship. The child contains the <parent> entry, the parent module is the one referenced.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Parent with multi module