The Tutorial is included by default in the Java EE 7 SDK, which includes GlassFish 4.0. If you installed a standalone version of GlassFish 4.0, you can install the Tutorial, but you first need to activate the Java EE SDK publisher in the Update Tool.
release.javaeesdk.oracle.comPublisher, then click Ok.
The Tutorial's Maven build system uses Cargo to deploy applications to GlassFish. The configuration of Cargo in the Tutorial assumes that the default Java EE 7 SDK install location is being used. On Windows platforms, this is
c:\\glassfish4. On Unix platforms, this is
If you've installed the SDK to a non-default location, you must define the
glassfish.home property to point to the correct location in order to deploy applications using Cargo. There are two ways to do this. The preferred way is to create and activate a profile in your Maven
1. If you don't already have one, create a settings.xml file in your Maven users directory,
$HOME/.m2/settings.xml in a text editor, then add and activate a new profile. The following shows an example that sets
<?xml version="1.0" encoding="UTF-8"?> <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <profiles> <profile> <id>non-default-glassfish</id> <properties> <glassfish.home>d:/javaee7sdk</glassfish.home> </properties> </profile> </profiles> <activeProfiles> <activeProfile>non-default-glassfish</activeProfile> </activeProfiles> </settings>3. Save
4. Make sure GlassFish is running, then build and run an example application.
You can also edit the
glassfish.home property defined in
<glassfish.home>/docs/javaee-tutorial/examples/pom.xml. This is not recommended, however, as this file will be overwritten on subsequent updates of the Tutorial.
When you run the Tutorial examples for the first time, the Maven build system will download the required Maven plugins from the central Maven repository. If your network is behind a proxy, you need to configure Maven to use the network proxy server to access the repository. See the Maven documentation for information on configuring Maven to use a proxy.