• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSF2 with JPA2 module - how can i create 2 projs using Maven (Eclipse)

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

i am not very versed with Maven.
so i am trying to achieve something that i understand the process.

in Eclipse, i have created a JSF2 project, and i would like to have a second project (child/module) for the JPA2 (DB logic).
if i try creating a new project as:
new Maven Module

it will give an error saying:
The parent project must have a packaging type of POM

i have tried to understand this document here:
https://maven.apache.org/plugins/maven-eclipse-plugin/reactor.html

it seems that i am not able to understand the explanation.

the aspects of packaging the parent project into POM, and adding this POM reference to the child/module project seems counter intuitive.
as i expected these references to the other way around.

could i ask for some clarification here?

thanks,





 
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don’t know, but this question is too difficult for “beginning”, so I shall move it. Not sure where: lte’s try the Maven forum.
 
nicolas diogo
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for moving into a better area
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It sounds like you referenced a parent in your POM. That is, you pom.xml has a <parent> section. If you do that, the parent artifact must be of package type "pom".

Maven supports two different POM hierarchies:

One is the master/subproject hierarchy. In this hierarchy you have a master POM that, when you run a build, will also build submodules. This hierarchy is defined by placing a <modules> entry into the master POM. The mast and submodule POMs can use any packaging type. Example: a master POM with packaging type of "ear" might have submodules of type "jar" (for an EJB project) and "war" (for the web app project).

The other is the parent/child hierarchy. In this hierarchy the parent defines a common build structure (plugins, dependencies, properties, etc) that is then used by one of more child projects. This hierarchy is defined by placing a <parent> entry into the child POM. In this case the parent POM must use a packaging type of "pom" because that POM doesn't define any artifact other than itself. Example: you might have a parent POM that defines all of the typical things that you need in yoru environment to build a JSF web apps, this would include the JSP library, perhaps some javascript libraries, JUnit, plugins that define the WAR contents, etc, etc. Then each individual JSP web app would reference that parent POM (thus inheriting all of its app definition), and would then need to define very few things. (At work we make extensive use of parent POMs so that every artifact of a specific kind is built exactly the same way; in addition most of our specific POMs for an app have almost no information in them except for maybe some additional dependencies - we end up with very short POMs)

At work I constantly preach against people confusing the two hierarchies (lost of example on the web mix the two hierarchies thus adding to the confusion). My recommendation is to never use the master/submodule hierarchy - if you need that build it into Jenkins. But use the parent/child relationship everywhere that you can; it significant reduces rework (I wholly support the DRY principle - Don't Repeat Yourself).

The free online book Maven: The Definitive Guide has a good explanation of the two hierarchies.
 
reply
    Bookmark Topic Watch Topic
  • New Topic