java ee - Why use a parent pom file when generating an ear file? -
i read question on - how add war inside ear maven
in top voted answer "joelittlejohn" -
"now create parent module (with pom) , add war module , ear module it. make sure set parent of war , ear modules corrently. when run mvn package new parent, war file built war module , ear file (containing war) built ear module."
but why create parent pom ? why not created standard maven project single pom. single pom file contains dependencies & modules, generate .ear file 1 pom file ?
something :
<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>
it's typical in maven have module each war want build. , .ear file contain multiple wars. having module each provides nice separation of duties. parent pom wraps together.
Comments
Post a Comment