maven ear plugin not picking up application.xml

Ikthiander picture Ikthiander · Oct 7, 2011 · Viewed 11.1k times · Source

I am using jbosscc-seam-archtype 1.2 and I am putting the application.xml in EAR project, under /src/main/application/META-INF/ but the maven-ear-plugin is not picking it up. any suggestion?

Here is the snippet of my maven EAR plugin:

<plugins>
    <plugin>
            <artifactId>maven-ear-plugin</artifactId>
            <configuration>
                <version>5</version>    
                <modules>
                    <webModule>
                        <groupId>com.***</groupId>
                        <artifactId>***-war</artifactId>
                        <contextRoot>***</contextRoot>
                        <unpack>${exploded.war.file}</unpack>
                    </webModule>

                    <jarModule>
                        <groupId>com.***</groupId>
                        <artifactId>***-datamodel</artifactId>
                        <includeInApplicationXml>true</includeInApplicationXml>
                    </jarModule>

                    <ejbModule>
                        <groupId>com.***</groupId>
                        <artifactId>***-bootstrap</artifactId>
                        <excluded>${exclude.bootstrap}</excluded>
                    </ejbModule>

                    <ejbModule>
                        <groupId>org.jboss.seam</groupId>
                        <artifactId>jboss-seam</artifactId>
                    </ejbModule>

                    <jarModule>
                        <groupId>org.jboss.el</groupId>
                        <artifactId>jboss-el</artifactId>
                        <bundleDir>lib</bundleDir>
                    </jarModule>

                </modules>

                <jboss>
                    <version>${version.jboss.app}</version>
                    <loader-repository>***:app=ejb3</loader-repository>
                </jboss>
            </configuration>
        </plugin>

What am I doing wrong?

Answer

Alfredo Osorio picture Alfredo Osorio · Apr 18, 2016

By default, your application.xml will not be picked even if you include it in src/main/application/META-INF/application.xml in your maven ear project that's because it will be autogenerated by the configuration specified at <configuration> of the maven-ear-plugin. If you want yours to be included you need to change generateApplicationXml to false (defaults to true).

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-ear-plugin</artifactId>
    <version>2.4.2</version>
    <configuration>
        <version>6</version>
        <displayName>MyEAR</displayName>
        <defaultLibBundleDir>lib</defaultLibBundleDir>
        <modules>
            <webModule>
                <groupId>com.test</groupId>
                <artifactId>my-web</artifactId>
                <bundleFileName>my-web.war</bundleFileName>
                <contextRoot>/MyWeb</contextRoot>
            </webModule>
        </modules>
        <generateApplicationXml>false</generateApplicationXml>            
    </configuration>
  </plugin>