title: How to deploy ear into WildFly 8.0 via eclipse IDE
body: <p>I have installed the JBoss AS tools in my eclipse. Then I have created an WildFly 8.0 server. I have parent project pom.xml like below:</p>
  
  <pre><code>&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;com.company&lt;/groupId&gt;
      &lt;artifactId&gt;trx-server-parent&lt;/artifactId&gt;
      &lt;version&gt;1.0.0&lt;/version&gt;
      &lt;packaging&gt;pom&lt;/packaging&gt;
  
      &lt;properties&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
          &lt;java-version&gt;1.7&lt;/java-version&gt;
  
          &lt;javaee-api-version&gt;7.0&lt;/javaee-api-version&gt;
      &lt;/properties&gt;
  
      &lt;modules&gt;
          &lt;module&gt;trx-server-ear&lt;/module&gt;            
          &lt;module&gt;trx-server-domain&lt;/module&gt;
          &lt;module&gt;trx-server-services&lt;/module&gt;
          &lt;module&gt;trx-server-web&lt;/module&gt;
      &lt;/modules&gt;
  
      &lt;dependencyManagement&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;${javaee-api-version}&lt;/version&gt;
              &lt;/dependency&gt;
          &lt;/dependencies&gt;
      &lt;/dependencyManagement&gt;
  
      &lt;build&gt;
          &lt;pluginManagement&gt;
              &lt;plugins&gt;
                  &lt;!-- compiler plugin --&gt;
                  &lt;plugin&gt;
                      &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                      &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                      &lt;version&gt;3.2&lt;/version&gt;
                      &lt;configuration&gt;
                          &lt;source&gt;${java-version}&lt;/source&gt;
                          &lt;target&gt;${java-version}&lt;/target&gt;
                          &lt;encoding&gt;${project.build.sourceEncoding}&lt;/encoding&gt;
                      &lt;/configuration&gt;
                  &lt;/plugin&gt;
                  &lt;plugin&gt;
                      &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                      &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt;
                      &lt;version&gt;2.5&lt;/version&gt;
                      &lt;configuration&gt;
                          &lt;failOnMissingWebXml&gt;false&lt;/failOnMissingWebXml&gt;
                      &lt;/configuration&gt;
                  &lt;/plugin&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.4&lt;/version&gt;
                      &lt;configuration&gt;
                          &lt;ejbVersion&gt;3.2&lt;/ejbVersion&gt;
                      &lt;/configuration&gt;
                  &lt;/plugin&gt;
                  &lt;plugin&gt;
                      &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                      &lt;artifactId&gt;maven-ear-plugin&lt;/artifactId&gt;
                      &lt;version&gt;2.9.1&lt;/version&gt;
                  &lt;/plugin&gt;
              &lt;/plugins&gt;
          &lt;/pluginManagement&gt;
      &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>And ear project pom.xml is like:</p>
  
  <pre><code>&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;parent&gt;
          &lt;groupId&gt;com.company&lt;/groupId&gt;
          &lt;artifactId&gt;trx-server-parent&lt;/artifactId&gt;
          &lt;version&gt;1.0.0&lt;/version&gt;
      &lt;/parent&gt;
      &lt;artifactId&gt;trx-server-ear&lt;/artifactId&gt;
      &lt;packaging&gt;ear&lt;/packaging&gt;
  
      &lt;dependencies&gt; 
          &lt;dependency&gt;
              &lt;groupId&gt;com.company&lt;/groupId&gt;
              &lt;artifactId&gt;trx-server-web&lt;/artifactId&gt;
              &lt;version&gt;${project.version}&lt;/version&gt;
              &lt;type&gt;war&lt;/type&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.company&lt;/groupId&gt;
              &lt;artifactId&gt;trx-server-services&lt;/artifactId&gt;
              &lt;version&gt;${project.version}&lt;/version&gt;
              &lt;type&gt;ejb&lt;/type&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;finalName&gt;trx-server&lt;/finalName&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-ear-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
                      &lt;finalName&gt;trx-server&lt;/finalName&gt;
                      &lt;version&gt;7&lt;/version&gt;
                      &lt;defaultJavaBundleDir&gt;lib/&lt;/defaultJavaBundleDir&gt;
                      &lt;modules&gt;                        
                          &lt;webModule&gt;
                              &lt;groupId&gt;com.company&lt;/groupId&gt;
                              &lt;artifactId&gt;trx-server-web&lt;/artifactId&gt;
                              &lt;contextRoot&gt;/trx-server-web&lt;/contextRoot&gt;
                          &lt;/webModule&gt;
                          &lt;ejbModule&gt;
                              &lt;groupId&gt;com.company&lt;/groupId&gt;
                              &lt;artifactId&gt;trx-server-services&lt;/artifactId&gt;
                          &lt;/ejbModule&gt;
                      &lt;/modules&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>I defined the trx-server-domain module as jar file and packaged into the lib folder. When run <code>mvn clean install</code> on my parent pom.xml, I got an ear file named trx-server.ear. Then the trx-server.ear file structure is like:</p>
  
  <pre><code>-- trx-server
     -- lib
        -- trx-server-domain-1.0.0.jar
     -- trx-server-services-1.0.0.jar
     -- trx-server-web-1.0.0.war
  </code></pre>
  
  <p>I can deploy this ear file to WildFly server manually (via web management page). Everything is fine for that.</p>
  
  <p>My problem is when I deploy some changes via Eclipse, I mean via the server adapter. The root web contextRoot is not what I defined in the ear project pom.xml file. And the trx-server-domain will be deploy as EJB which should be a jar file under lib folder.</p>
  
  <p>I got a trx-server-ear.ear folder in the WildFly deployments directory which is not what I wanted. The structures of this folder is:</p>
  
  <pre><code>trx-server-ear.ear
  -- trx-server-domain-1.0.0.jar
  -- trx-server-services-1.0.0.jar
  -- trx-server-web-1.0.0.war
  </code></pre>
  
  <p>No lib folder and all jar/war files are in same level.</p>
  
  <p>The problem only exist when I deploy the ear in the Eclipse. Is there any other plungin I should install?</p>
  
  <p>Anyone could give me example of how to configure the ear with multiple modules?</p>