Overview
This page provides instructions on how to build the Payara Server’s source code.
Prerequisites
To build and run Payara Server, your environment must be set up with the following:
-
Oracle JDK 8 Update 162 or later.
-
Maven 3.3.9 or above
-
Git
-
A
JAVA_HOME
environment variable pointing to the JDK install location (e.g. /home/user/jdk11.8.0_45/) -
A
PATH
environment variable that has a pointer to the Java binaries (JAVA_HOME/bin
)
You can also optionally add the Maven bin folder to the PATH
environment
variable as well, and the documentation will assume that you have done so.
Configuring Maven
If using JDK 7, you will need to increase the heap size and PermGen size to prevent the build process from running out of memory.
Create a MAVEN_OPTS
environment variable and set it as:
-Xmx1024m
Getting the Source Code
To download the Payara Server’s source code, open a terminal or Git Bash
window, navigate to the directory you would like the source code to be
downloaded to, and run git clone https://github.com/payara/Payara.git
.
This will download the Payara Server’s source code, and initialize git, in a directory called Payara.
Building Payara Server
With your Git Bash or terminal window, navigate into the downloaded Payara directory, and run:
mvn clean install
This will build Payara and run the integrated GlassFish unit tests. To save a bit of time, you can skip these tests by appending the skipTests flag to the install command like so:
mvn clean install -DskipTests
Building Payara Micro
Since release 164, Payara Micro is included as part of the default build. As it depends on modules of Payara Server, it can’t be built on its own. To build Payara Micro:
mvn clean install -DskipTests
After the build has completed, the Payara Micro jar can be found in the target directory at:
appserver/extras/payara-micro/payara-micro-distribution/target/
Building Payara Docker Images
The source code of the Official Docker Images is also integrated in the main Payara repository. In order to be able to build these images, a Docker Client needs to be installed on the machine you execute the Maven command.
mvn clean install -PBuildExtras,BuildDockerImages -pl :docker-images -amd
The Maven build expects that a regular build of Payara is already executed as it searches for some artifacts in the Maven repository (like SNAPSHOT builds of the server)
Additional Build Profiles
There are a number of additional Maven build profiles:
mvn clean install
mvn clean install -PBuildExtras
mvn clean install -PQuickBuild
Payara Version | clean install | -PBuildExtras | -PQuickBuild |
---|---|---|---|
Payara Server |
✓ |
✓ |
✓ |
Payara Server (Web Profile) |
✓ |
✓ |
|
Payara Server Multi Language |
✓ |
✓ |
|
Payara Server Multi Language (Web Profile) |
✓ |
✓ |
|
Payara Micro |
✓ |
✓ |
|
Payara Embedded |
✓ |
||
Payara Embedded (Web Profile) |
✓ |
To save time on builds, you can also add the flag skipTests:
mvn clean install -DskipTests
This will cut out all build tests so will save quite a bit of time.