Apache Maven Maven EAR plugin A basic EAR configuration

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

<dependencies>
    <dependency>
        <groupId>{ejbModuleGroupId}</groupId>
        <artifactId>{ejbModuleArtifactId}</artifactId>
        <version>{ejbModuleVersion}</version>
        <type>ejb</type>
    </dependency>
    <dependency>
        <groupId>{webModuleGroupId}</groupId>
        <artifactId>{webModuleArtifactId}</artifactId>
        <version>{webModuleVersion}</version>
        <type>war</type>
    </dependency>
</depencencies>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-ear-plugin</artifactId>
                <version>2.9.1</version>
                <configuration>
                    <version>1.4</version><!-- application.xml verion -->
                    <modules>
                        <ejbModule>
                            <groupId>{ejbModuleGroupId}</groupId>
                            <artifactId>{ejbModuleArtifactId}</artifactId>
                        </ejbModule>
                        <webModule>
                            <groupId>{webModuleGroupId}</groupId>
                            <artifactId>{webModuleArtifactId}</artifactId>
                            <contextRoot>/custom-context-root</contextRoot>
                        </webModule>
                    </modules>
                </configuration>
        </plugin>
    </plugins>
</build>

Once compiled mvn clean install, generates an .ear artifact in the target directory containing both the ejb (.jar) and the web module, along with the application.xml JEE description file.



Got any Apache Maven Question?