简体   繁体   中英

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

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>

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>

I had the same problem, and in my case it turned out that Maven was not generating the application.xml file. The solution was removing from pom.xml the option:

<generateApplicationXml>true</generateApplicationXml>

The default value is "true", so this line was not necessary... and this somehow solved the issue

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM