$ mvn archetype:generate \ -DarchetypeGroupId=org.apache.maven.archetypes \ -DarchetypeArtifactId=maven-archetype-quickstart \ -DarchetypeVersion=1.5 \ -DgroupId=mtitek.maven.ear.samples \ -DartifactId=mtitek-maven-ear-samples \ -Dpackage=mtitek.maven.ear.samples \ -Dversion=1.0.0-SNAPSHOT \ -DinteractiveMode=falseYou have to modify the created project to adjust it to an EAR project:
<packaging>ear</packaging>
$ rm -rf src/main/*
$ rm -rf src/test/*
$ mkdir src/main/application
$ mvn archetype:generate \ -DarchetypeGroupId=org.apache.maven.archetypes \ -DarchetypeArtifactId=maven-archetype-j2ee-simple \ -DgroupId=mtitek.maven.jee.samples \ -DartifactId=mtitek-maven-jee-samples \ -Dversion=1.0.0-SNAPSHOT \ -DinteractiveMode=false-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>mtitek.maven.ear.samples</groupId> <artifactId>mtitek-maven-ear-samples</artifactId> <version>1.0.0-SNAPSHOT</version> <packaging>ear</packaging> <dependencies> <dependency> <groupId>mtitek.maven.jar.samples</groupId> <artifactId>mtitek-maven-jar-samples</artifactId> <version>1.0.0-SNAPSHOT</version> <type>jar</type> </dependency> <dependency> <groupId>mtitek.maven.war.samples</groupId> <artifactId>mtitek-maven-war-samples</artifactId> <version>1.0.0-SNAPSHOT</version> <type>war</type> </dependency> <dependency> <groupId>mtitek.maven.ejb.samples</groupId> <artifactId>mtitek-maven-ejb-samples</artifactId> <version>1.0.0-SNAPSHOT</version> <type>ejb</type> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-ear-plugin</artifactId> <version>3.3.0</version> <configuration> <version>7</version> <defaultLibBundleDir>lib</defaultLibBundleDir> <filtering>true</filtering> <modules> <ejbModule> <groupId>mtitek.maven.ejb.samples</groupId> <artifactId>mtitek-maven-ejb-samples</artifactId> <bundleDir>/</bundleDir> </ejbModule> <webModule> <groupId>mtitek.maven.war.samples</groupId> <artifactId>mtitek-maven-war-samples</artifactId> <bundleDir>/</bundleDir> <contextRoot>/cr/warPackage</contextRoot> </webModule> </modules> </configuration> </plugin> </plugins> </build> </project>Build the project:
$ mvn clean install