wood burning stoves 2.0*
The moose likes Ant, Maven and Other Build Tools and the fly likes Ear Building in Maven Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Ear Building in Maven" Watch "Ear Building in Maven" New topic
Author

Ear Building in Maven

Kris Massey
Greenhorn

Joined: Mar 26, 2009
Posts: 12
Hey guys...Ive been trying to figure this out for a couple of hours now and just cant see the issue...

Below Ive added 5 pom.xml files that Ive fog...one Java Module, one EJB module, one Web module, One Enterprise Module and the master pom

Java Module



EJB Module


Web Module


Enterprise module


Master Pom



When I try and package everything the Java, EJB and Web modules work fine...however the Enterprise module fails with the error below



My file structure is
myMultiProjectArtifactId
--myJavaModule1
--myEJBModule1
--myWebApplicationModule1
--myEnterpriseApplicationModule


Im sure the problem is fairly simple but this is the first time Ive tried using maven this way and really am stumped..any help would be great!

Cheers
Kris
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Very quick response here (I'm running out the door), I think it's because you haven't declared the dependencies in the POM for your EAR.


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
Kris Massey
Greenhorn

Joined: Mar 26, 2009
Posts: 12
and thats where you lose me! do you mean like this?



Im sure you know what if I add it throws an error about a missing artifact...
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

OK, Looking at it a little more in detail this morning (warning no coffee yet!), I see that you have in your EAR pom items like:

# <!-- 4.5.1. Include Java Module. -->
# <javaModule>
# <groupId>myMultiProjectGroupId.myMultiProjectArtifactId</groupId>
# <artifactId>module1</artifactId>
# <artifactId>1.0</artifactId>
#
# <!-- 4.5.1.1. Only if you want different file name inside "ear" file. -->
# <bundleFileName>myBundleJavaModule1FileName</bundleFileName>
# </javaModule>

I assume you're using Maven 2.0.10 or 2.1.0?

* Having <artifactId> twice seems wrong to me, but I wouldn't use javaModule in the first place (see next point)
* Using javaModule is deprecated, use jarModule instead, e.g.:



The dependency is then listed as:


Kris Massey
Greenhorn

Joined: Mar 26, 2009
Posts: 12
Thanks for the help...

I managed to get it all working this morning after tinkering with a few things, all the changes were in the ejbModule pom file which Ive added incase anyone gets the same problem and comes across this.



One quick question is about the dependecy below Ive had to add



Could you give me a brief guide as to why this is needed?
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

I'm not sure why you need that dependency, what complains when you don't have it?
Kris Massey
Greenhorn

Joined: Mar 26, 2009
Posts: 12


is the error I get, I googled it an everyone says just add it as provded inthe scope and everything works...seems a but of a bodge to me and I would like to know why its needed
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Hmm, I'm afraid I can't easily tell you why, I certainly don't include it for my Maven EAR builds!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Ear Building in Maven