Java EE 8 Development with Eclipse - Third Edition by Ram Kulkarni

Java EE 8 Development with Eclipse - Third Edition by Ram Kulkarni

Author:Ram Kulkarni [Ram Kulkarni]
Language: eng
Format: epub
Tags: COM051280 - COMPUTERS / Programming Languages / Java, COM051230 - COMPUTERS / Software Development and Engineering / General, COM051000 - COMPUTERS / Programming / General
Publisher: Packt
Published: 2018-06-26T13:35:54+00:00


Artifact ID

CourseManagementMavenEAR

Version

1

Packaging

ear

You will have to type ear in the Packaging file; there is no ear option in the drop-down list. Add dependencies of web, ejb, and client projects to pom.xml, as follows:

<dependencies> <dependency> <groupId>packt.book.jee.eclipse.ch7.maven</groupId> <artifactId>CourseManagementMavenEJBClient</artifactId> <version>1</version> <type>jar</type> </dependency> <dependency> <groupId>packt.book.jee.eclipse.ch7.maven</groupId> <artifactId>CourseManagementMavenEJBs</artifactId> <version>1</version> <type>ejb</type> </dependency> <dependency> <groupId>packt.book.jee.eclipse.ch7.maven</groupId> <artifactId>CourseManagementMavenWebApp</artifactId> <version>1</version> <type>war</type> </dependency> </dependencies>

Make sure to set <type> of each dependency properly. You also need to update JNDI URLs for any name changes.

Maven does not have built-in support to package EAR. However, there is a Maven plugin for EAR. You can find details of this plugin at https://maven.apache.org/plugins/maven-ear-plugin/ and https://maven.apache.org/plugins/maven-ear-plugin/modules.html. We need to add this plugin to our pom.xml and configure its parameters. Our EAR file will contain the JAR for the EJB project, the client project, and the WAR for the web project. Right-click on pom.xml of the EAR project, and select Maven | Add Plugin. Type ear in the Filter box, and select the latest plugin version under maven-ear-plugin. Make sure that you also install the maven-acr-plugin plugin. Configure the EAR plugin in the pom.xml details, as follows:

<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-acr-plugin</artifactId> <version>1.0</version> <extensions>true</extensions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-ear-plugin</artifactId> <version>2.10</version> <configuration> <version>6</version> <defaultLibBundleDir>lib</defaultLibBundleDir> <modules> <webModule> <groupId>packt.book.jee.eclipse.ch7.maven</groupId> <artifactId>CourseManagementMavenWebApp</artifactId> </webModule> <ejbModule> <groupId>packt.book.jee.eclipse.ch7.maven</groupId> <artifactId>CourseManagementMavenEJBs</artifactId> </ejbModule> < jarModule > <groupId>packt.book.jee.eclipse.ch7.maven</groupId> <artifactId>CourseManagementMavenEJBClient</artifactId> </ jarModule > </modules> </configuration> </plugin> </plugins> </build>

After modifying pom.xml, sometimes Eclipse may display the following error:

Project configuration is not up-to-date with pom.xml. Run Maven->Update Project or use Quick Fix...

In such cases, right-click on the project and select Maven | Update Project.

The last project that we create in this section is CourseManagement, which will be the container project for all other EJB projects. When this project is installed, it should build and install all the contained projects. Create a Maven project with the following details:

Fields

Values



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.