aspose file tools*
The moose likes IDEs, Version Control and other tools and the fly likes Maven Build Script Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Maven Build Script Problem" Watch "Maven Build Script Problem" New topic
Author

Maven Build Script Problem

Deep Mukherjee
Greenhorn

Joined: Jan 04, 2010
Posts: 20
I have a problem building my project with maven.I have to create a war file
containing a ejb jar and a war.
i have separate pom.xml for ejb project and a web project..
structure should be like this....

source project
.
.
......pom.xml
.
.
........ejb project
. .
. .
. .
. .......source code
. .
. .
. .......pom.xml
.
.
.
.
.........web project
.
.
.
.
.....source code
.
.
.
.....pom.xml


individually i am able to create ejb jar(ejb project) and war (web project).
but i want to do mvn install only on source project and it would bild the jar
(ejb project)and war(web project) and then(source project) create a ear in one
go.can any one suggest what modification i have to do on pom.xml of source project
for doing this and also web project has dependency on ejb project .Can any one please give me sample
example of source pom.how should it looks like
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5830
    
    7

Here is what I do. I create a master Maven project with three subprojectsne to build the WAR, one to build the JAR and one to build the EAR. Directory layout is similar to:

masterproject
masterproject/warproject
masterproject/ejbproject
masterproject/earproject

The pom.xml in masterproject calls the three subprojects. The pom.xml in the subprojects all reference the mastterproject as the parent project. When I run the masterproject pom.xml, it builds everything.

JBoss In Action
Deep Mukherjee
Greenhorn

Joined: Jan 04, 2010
Posts: 20
Can you please give the sample pom of the parent project.....what are tags need tobe used....
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5830
    
    7

You have a copy of Better Builds with Maven, right? Look in chapter 4, Building J2EE Applications, specifically section 4.3, Organizing the DayTrader Directory Structure. Or if you have Maven - The Definitive Guide, see chapter 6, A Multimodule Project; it's parent pom.xml is more complete.
Deep Mukherjee
Greenhorn

Joined: Jan 04, 2010
Posts: 20
I have another question,How can i inclue or exclude .java (source)file in the ejb jar or war file.I want to customize the source folder structure.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5830
    
    7

Since that is a different question, you should start a new post.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Maven Build Script Problem