------ Maven 2 Ear Plugin: configuration examples ------ Stephane Nicoll ------ September 23, 2005 Introduction The Ear plugin allows to generate automatically the descriptor deployment, e.g. application.xml. This generation is already customized by the goal's parameters, see {{{index.html}the goals description}}. Any Ear module might be further customized as follows: * bundleDir: the directory in the EAR structure where the artifact will be stored * bundleFileName: the name of the artifact in the EAR structure * uri: the complete path in the EAR structure for the artifact * excluded: excludes the artifact from the generated ear The context root of a Web module might be customized using the contextRoot parameter. Please note that third party libraries are not included in the generated application.xml (only ejb-client should be included in a entry). However, a jar dependency could be included in the generated application.xml by specifying the includeInApplicationXml flag. It is also possible to specify a default bundle directory for all third party libraries. The security settings might be specified under the security parameter. Customizing the context root The sample below shows how to customize the context root of an artifact to be placed in the EAR file: +-------- org.apache.maven.plugins maven-ear-plugin [...] artifactGroupId artifactId /custom-context-root +--------- Customizing a module location The sample below shows how to place a library in the APP-INF/lib directory of the EAR file: +-------- org.apache.maven.plugins maven-ear-plugin [...] artifactGroupId artifactId APP-INF/lib +--------- Note that it is possible to specify a default bundle directory for all Java modules. If a Java module has not the bundleDir property above, the default one is used. Here is an example of such configuration: +-------- org.apache.maven.plugins maven-ear-plugin [...] APP-INF/lib artifactGroupId artifactId / +--------- In this case, all Java modules will be placed in the APP-INF/lib directory except the specified artifact which will be placed at the root of the EAR structure. Customizing a module file name The sample below shows how to rename a module being placed in the EAR file: +-------- org.apache.maven.plugins maven-ear-plugin [...] artifactGroupId artifactId anotherName-1.2.3.jar +--------- Customizing a module uri This is actually a combination of customizing the module's location and file name. The sample below shows how to specify the URI of a module being placed in the EAR file: +-------- org.apache.maven.plugins maven-ear-plugin [...] artifactGroupId artifactId APP-INF/lib/anotherName-1.2.3.jar +--------- Excluding a module If for some reason a dependency which is declared in the pom of the project needs to be excluded, the excluded flag could be used as follows: +-------- org.apache.maven.plugins maven-ear-plugin [...] artifactGroupId artifactId true +--------- Including a third party library in the generated application.xml If third party libraries need to be included in the generated application.xml, the 'includeInApplicationXml' flag could be used. This flag works only for java modules. +-------- org.apache.maven.plugins maven-ear-plugin [...] artifactGroupId artifactId true +--------- Specifying security roles for the generated application.xml Security roles might be specified as follows +-------- org.apache.maven.plugins maven-ear-plugin [...] manager My cool description teller +---------