title: Maven EJB packaging with dependent libraries
body: <p>Im facing an issue how to correctly package my enterprise (EAR) application with simple WAR and EJB3 module for JBoss7 application server. The thing is, that EJB module is using XML-RPC library (from Apache) and Im still getting <code>NoDefClassFound</code> (classes from this xmlrpc lib) during deployment of EAR.</p>
  
  <p>The thing is, that maven-<strong>ejb</strong>-plugin does <strong>not</strong> package dependencies within final EJB jar but maven-<strong>ear</strong>-plugin does package it at the root of EAR directory. </p>
  
  <p>When EAR gets deployed, INSTALL is invoked on inner EJB module but it does not find xmlrpc lib class (it is not packaged with EJB jar but EAR and it does not have any entry in manifest).</p>
  
  <p>EJB pom.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;cz.ctu.fee.voxport.app_logic&lt;/groupId&gt;
      &lt;artifactId&gt;core&lt;/artifactId&gt;
      &lt;version&gt;1.0&lt;/version&gt;
      &lt;packaging&gt;ejb&lt;/packaging&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax&lt;/groupId&gt;
              &lt;artifactId&gt;javaee-api&lt;/artifactId&gt;
              &lt;version&gt;6.0&lt;/version&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.xmlrpc&lt;/groupId&gt;
              &lt;artifactId&gt;xmlrpc-common&lt;/artifactId&gt;
              &lt;version&gt;3.1.3&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.xmlrpc&lt;/groupId&gt;
              &lt;artifactId&gt;xmlrpc-client&lt;/artifactId&gt;
              &lt;version&gt;3.1.3&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-ejb-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.3&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;ejbVersion&gt;3.1&lt;/ejbVersion&gt;
                      &lt;archive&gt;
                          &lt;manifest&gt;
                              &lt;addClasspath&gt;true&lt;/addClasspath&gt;
                          &lt;/manifest&gt;
                      &lt;/archive&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>Is there any way how to cleanly solve this using maven? </p>