title: How to add a file to EAR META-INF folder - Maven
body: <p>I want to move a <code>startup MBEAN</code> file <code>(startup-client-service.xml)</code> from my <code>EJB</code> ><code>META-INF</code>,  to <code>EAR</code>> <code>META-INF</code> folder. I tried with the <code>maven-resources-plugin</code> plugin but it just copy the file from <code>EJB</code> ><code>META-INF</code> to <code>Target</code> in <code>ear</code> folder. But in built <code>ear</code> the <code>startup-client-service.xml</code> file is not available in <code>META-INF</code></p>
  
  <p>How can I move my startup file to META-INF into ear > META-INF ?</p>
  
  <p>This is the pom file of ear.</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/maven-v4_0_0.xsd"&gt;
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
  &lt;parent&gt;
      &lt;groupId&gt;com.testapp&lt;/groupId&gt;
      &lt;artifactId&gt;my-client-parent&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  &lt;/parent&gt;
  
  &lt;name&gt;Test app EAR&lt;/name&gt;
  &lt;artifactId&gt;my-client-ear&lt;/artifactId&gt;
  
  &lt;packaging&gt;ear&lt;/packaging&gt;
  
  &lt;dependencies&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;com.testapp&lt;/groupId&gt;
          &lt;artifactId&gt;my-client-ejb&lt;/artifactId&gt;
          &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
          &lt;type&gt;ejb&lt;/type&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-ear-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.8&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;defaultLibBundleDir&gt;lib&lt;/defaultLibBundleDir&gt;
                  &lt;modules&gt;
                  &lt;/modules&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-resources-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.6&lt;/version&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;id&gt;copy-resources&lt;/id&gt;
                      &lt;phase&gt;validate&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;copy-resources&lt;/goal&gt;
                      &lt;/goals&gt;
                      &lt;configuration&gt;
                          &lt;outputDirectory&gt;META-INF&lt;/outputDirectory&gt;
                          &lt;resources&gt;
                              &lt;resource&gt;
                                  &lt;directory&gt;${project.parent.basedir}/ejb/src/main/resources/META-INF&lt;/directory&gt;
                                  &lt;filtering&gt;true&lt;/filtering&gt;
                              &lt;/resource&gt;
                          &lt;/resources&gt;
                      &lt;/configuration&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
      &lt;pluginManagement&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.eclipse.m2e&lt;/groupId&gt;
                  &lt;artifactId&gt;lifecycle-mapping&lt;/artifactId&gt;
                  &lt;version&gt;1.0.0&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;lifecycleMappingMetadata&gt;
                          &lt;pluginExecutions&gt;
                              &lt;pluginExecution&gt;
                                  &lt;pluginExecutionFilter&gt;
                                      &lt;groupId&gt;
                                          org.apache.maven.plugins
                                      &lt;/groupId&gt;
                                      &lt;artifactId&gt;
                                          maven-ear-plugin
                                      &lt;/artifactId&gt;
                                      &lt;versionRange&gt;
                                          [2.8,)
                                      &lt;/versionRange&gt;
                                      &lt;goals&gt;
                                          &lt;goal&gt;
                                              generate-application-xml
                                          &lt;/goal&gt;                                         
                                      &lt;/goals&gt;
                                  &lt;/pluginExecutionFilter&gt;
                                  &lt;action&gt;
                                      &lt;ignore&gt;&lt;/ignore&gt;
                                  &lt;/action&gt;
                              &lt;/pluginExecution&gt;
                          &lt;/pluginExecutions&gt;
                      &lt;/lifecycleMappingMetadata&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/pluginManagement&gt;
  &lt;/build&gt;
  
  &lt;profiles&gt;
      &lt;profile&gt;
          &lt;id&gt;copy_bundle&lt;/id&gt;
          &lt;properties&gt;
              &lt;install.dir&gt;${jboss.dir}\server\default\deploy&lt;/install.dir&gt;
          &lt;/properties&gt;
          &lt;build&gt;
              &lt;plugins&gt;
                  &lt;plugin&gt;
                      &lt;artifactId&gt;maven-antrun-plugin&lt;/artifactId&gt;
                      &lt;executions&gt;
                          &lt;execution&gt;
                              &lt;id&gt;Copying bundle to destination folder&lt;/id&gt;
                              &lt;phase&gt;package&lt;/phase&gt;
                              &lt;goals&gt;
                                  &lt;goal&gt;run&lt;/goal&gt;
                              &lt;/goals&gt;
                              &lt;configuration&gt;
                                  &lt;tasks&gt;
                                      &lt;copy
                                          file="${project.build.directory}/${project.build.finalName}.${project.packaging}"
                                          overwrite="true" todir="${install.dir}" /&gt;
                                  &lt;/tasks&gt;
                              &lt;/configuration&gt;
                          &lt;/execution&gt;
                      &lt;/executions&gt;
                  &lt;/plugin&gt;
              &lt;/plugins&gt;
          &lt;/build&gt;
      &lt;/profile&gt;
  &lt;/profiles&gt;
  </code></pre>
  
  <p></p>
  
  <p>Below is the project workspace screen grab </p>
  
  <p><img src="https://i.stack.imgur.com/nadLo.jpg" alt="Here is the project structure "></p>