[jboss-user] [JBoss Tools] - Re: Jboss EE 6 EAR archetype, problem with EAR/lib

Fred Bricon do-not-reply at jboss.com
Tue Jan 8 12:22:36 EST 2013


Fred Bricon [https://community.jboss.org/people/fbricon] created the discussion

"Re: Jboss EE 6 EAR archetype, problem with EAR/lib"

To view the discussion, visit: https://community.jboss.org/message/789344#789344

--------------------------------------------------------------
Adding dependencies to an ear project doesn't make these dependencies available to the compilation classpath of its ejb/war/whatever modules.
Running mvn clean verify from your parent project folder clearly shows the ejb project doesn't compile.

You need to remove the flexjson dependency from the ear project and add it to the ejb pom.xml instead. 
That will add it to the project compilation classpath AND it will also be automatically deployed in the EAR's lib directory, as a transitive dependency.
Since the war project depends on the ejb, it'll see the flexjson jar as well. Now if the web project actually has a direct dependency towards flexjson, 
you'll need to add it to the war pom.xml as well : it's one of maven best practices as it will protect your project in case the ejb removes the dependency in the future. 
In that case,  the dependency should be added with a scope provided in the war pom.xml: 
<dependency>
          <groupId>net.sf.flexjson</groupId>
          <artifactId>flexjson</artifactId>
          <version>2.1</version>
   <scope>provided</scope>
</dependency>
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/789344#789344]

Start a new discussion in JBoss Tools at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2128]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20130108/4bbf6382/attachment.html 


More information about the jboss-user mailing list