Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Parent with multi module

 
mark smith
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
mark smith
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for the info

i thought i used paren / child structure
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic