Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to generate <application-name> entry with maven ear plugin

Tags:

java

xml

I have tried everything to get this added to my application.xml file, but the maven-ear-plugin will just not recognize the application name property testEar in my pom file.

<plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-ear-plugin</artifactId>
        <version>2.8</version>
        <configuration>
            <generateApplicationXml>true</generateApplicationXml>
            <applicationName>testEAR</applicationName>
            <earSourceDirectory>${basedir}/src/main/resources</earSourceDirectory>
            <resourcesDir>target/classes</resourcesDir>
            <defaultLibBundleDir>lib</defaultLibBundleDir>
            <modules>
                <JarModule>
                    <groupId>org</groupId>
                    <artifactId>test-client</artifactId>
                    <includeInApplicationXml>true</includeInApplicationXml>
                </JarModule>
            </modules>
            <archive>
                <manifest>
                    <addClasspath>true</addClasspath>
                </manifest>
            </archive>
        </configuration>
    </plugin>
</plugins>
like image 513
user1760120 Avatar asked Oct 19 '12 18:10

user1760120


1 Answers

I determined that the maven ear plugin by default was creating a non-EE6 application.xml, which does not support application-name.

I needed to add a new xml element (version) to the ear plugin to specify EE6.

<plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-ear-plugin</artifactId>
        <version>2.8</version>
        <configuration>
            <generateApplicationXml>true</generateApplicationXml>
            <applicationName>testEAR</applicationName>
            <earSourceDirectory>${basedir}/src/main/resources</earSourceDirectory>
            <resourcesDir>target/classes</resourcesDir>
            <version>6</version>
            <defaultLibBundleDir>lib</defaultLibBundleDir>
            <modules>
                <JarModule>
                    <groupId>org</groupId>
                    <artifactId>test-client</artifactId>
                    <includeInApplicationXml>true</includeInApplicationXml>
                </JarModule>
            </modules>
            <archive>
                <manifest>
                    <addClasspath>true</addClasspath>
                </manifest>
            </archive>
        </configuration>
    </plugin> </plugins>
like image 51
user1760120 Avatar answered Nov 03 '22 00:11

user1760120