简体   繁体   中英

EAR archive inside another EAR using Maven?

Can you put an ear archive inside another ear archive? I have tried adding an ear dependency to an ear module specifying artifact type as
<type>ear</type>
with maven 3.3.3 but I get
Failed to initialize ear modules: Unknown artifact type[ear]
If I don't specify an artifact type then maven looks for a jar artifact and fails to find it. Is there a way to do it? If not, is there a reason to prohibit inner ear archives?

An EAR archive can only contain WAR , JAR and RAR (Resource Archive) modules.

If you have an EAR project in Maven, you should add your EJB dependencies like this one:

<dependency>
    <type>ejb</type>
    <groupId>...</groupId>
    <artifactId>...</artifactId>
    <version>...</version>
</dependency>

and configure the maven-ear-plugin similarly

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-ear-plugin</artifactId>
    <configuration>
        ...
        <modules>
            <ejbModule>
                <groupId>...</groupId>
                <artifactId>...</artifactId>
            </ejbModule>
        </modules>
    </configuration>
</plugin>

For WAR dependencies you need to use <type>war</type> and <webModule> instead.

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