title: How to deploy a library with Java EE 6 / Glassfish 3.x
body: <p>I have got an EAR with two plain libraries. One of them being scala-library. If I deploy the EAR with Netbeans it works as expected. While this is OK for development the final product should be deployable via the command line. For this I use:</p>
  
  <pre><code>asadmin --user … deploy --upload ./target/…-ear.ear
  </code></pre>
  
  <p>which fails with:</p>
  
  <pre><code>org.glassfish.api.admin.CommandException: remote failure: Error occurred during deployment: Exception while deploying the app […-ear] : C:\Work\Workspa
  ces\…\Glassfish\…\applications\scala-library-2.8.0.jar. Please see server.log for more details.
  Befehl deploy fehlgeschlagen.
  </code></pre>
  
  <p>Searching the net I found out that handling libraries have become more strict with Java EE 6 / Glassfish 3.x and that it is not enough to add them to the <code>lib</code> folder inside the ear any more. Only the author neglected to mention what is needed now.</p>
  
  <p>I found new <code>&lt;module&gt;&lt;java&gt;</code> entries for the <code>META-INF\application.xml</code> — but that did not help either:</p>
  
  <pre><code>  &lt;module&gt;
      &lt;java&gt;scala-library-2.8.0.jar&lt;/java&gt;
    &lt;/module&gt;
  </code></pre>
  
  <p>So the question: Does anybody know what you have to do to add libraries to an EAR file for Java EE 6 / Glassfish 3.x?</p>
  
  <p>PS: I use Maven to build - if that makes any difference.</p>