Why use a parent pom file when creating an ear file?
I read this question on SO - How to add WAR inside EAR with Maven
In the top voted answer by "joelittlejohn" -
"Now create a parent module (with pom) and add the war and ear module to it. Make sure you have installed the parent of the war and ear modules. When you run the mvn package for this new parent, the war file will be built with the war and ear module ( containing war) will be created by the ear module. "
But why create a parent pom? Why not just create a standard maven project with just one pom. This single pom file contains dependencies and modules and then generates a .ear file from that one pom file?
Something like:
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<finalName>MyEarFile</finalName>
<version>5</version>
<generatedDescriptorLocation>${basedir}/src/main/application/META-INF</generatedDescriptorLocation>
<modules>
<webModule>
<groupId>com.your.group.id</groupId>
<artifactId>your-war-artifact</artifactId>
<uri>YouWarFile.war</uri>
<bundleFileName>YouWarFile.war</bundleFileName>
<contextRoot>/appname</contextRoot>
</webModule>
</modules>
</configuration>
<dependencies>
<dependency>
<groupId>com.your.group.id</groupId>
<artifactId>your-war-artifact</artifactId>
<version>your-war-version</version>
<type>war</type>
</dependency>
</dependencies>
</plugin>
+3
source to share