Skip to content

Building Open Liberty

Hiroko Takamiya edited this page Jan 25, 2024 · 22 revisions

Building Open Liberty

If you wish to build Open Liberty with Eclipse then follow these instructions: Building Open Liberty with Eclipse


Prerequisite software

  1. If you don't already have it, install git (> 2.0)

    Instructions
    • Download and install Git. Execute the file you downloaded, and accept the defaults.

    • (Windows) Configure Git to use long filepaths

      1. Run Git Bash as Administrator

      2. git config --system core.longpaths true

    • Windows users performance tip: Always start any git client including the git bash shell with "Run as Administrator"

    • If this is your first time using git, now is a good time to set your name and e-mail address. Your name and e-mail address will be stored in every commit you make. If you don't want to reveal your e-mail address publically, then you can use the noreply e-mail address generated for your github account.

      git config --global user.name "John Doe"

      git config --global user.email [email protected]

    • If you don't want to use "vi" editor when writing up the description for your commits, point git to your favorite text editor:

      git config --global core.editor 'c:/utility/emacs-24.3/bin/emacs.exe'

  2. (Optionally) set up SSH Keys

    If you plan to contribute code to Open Liberty, you should make sure you have SSH keys set up and linked to your Github account now.

    Instructions

    NOTE: All git commands which touch the network (fetch, push, pull) use SSH authentication. Ensure that you've started your SSH agent:

    eval "$(ssh-agent -s)"

  3. If you don't already have it, install a Java 17 SDK

    • Java 17 is the recommended version to build Open Liberty. Popular choices are:

    • After installing, make sure javac is available on your path

      javac --version
  4. If you don't already have it, install Apache Ant

    • This is not needed to build Open Liberty but it is needed to run FAT tests.

    • Download from the Apache Ant website and extract. The older 1.8.4 version is recommended.

    • After installing, make sure ant is available on your path

      ant -version

Get the Open Liberty code

Clone the repository to your system.

With SSH Keys:

git clone [email protected]:OpenLiberty/open-liberty.git

Without SSH Keys:

git clone https://github.com/OpenLiberty/open-liberty.git

This will download the whole repository (currently around 900 MB)

Build Open Liberty

cd open-liberty/dev

./gradlew cnf:initialize

./gradlew assemble

Initially, this process is expected to take between 20 to 40 minutes. Note that ./gradlew cnf:initialize is a one-time action, required only after you first clone the repository.

You should now have a built server in dev/build.image/wlp


If you plan to make modifications to the Open Liberty code, you can now move on to set up Eclipse IDE following these instructions: Building Open Liberty with Eclipse


Running tests

Now that you've built Open Liberty, you should be able to run tests against it.

./gradlew test to run all unit tests

./gradlew build.example_fat:buildandrun to run a FAT project

NOTE: ./gradlew build runs assemble and test tasks

Perform a local release

./gradlew releaseNeeded

NOTE: This task releases all projects to the local releaseRepo. The final openliberty zip can be found in

open-liberty\dev\cnf\release\dev\openliberty\<version>\openliberty-xxx.zip


Clone this wiki locally