WildFly Elytron

Setting up WildFly Elytron on Linux & WSL

This page will guide you through the steps needed to set up a development environment for WildFly Elytron on Linux or the Windows Subsystem for Linux (WSL). For WSL developers, all commands should be entered into the WSL terminal (i.e. not Command Prompt, PowerShell, or Git Bash).

Installing Java

  1. First, let’s check if you already have Java installed.

    1. Open a terminal and run java --version.

    2. If the output shows a version number, check to make sure it is Java 11 (e.g., "11.0.15.1"). If so, Java 11 is already installed and you can jump to the Installing Maven section. If the output is not Java 11, or if the output is command not found: java or a similar message indicating you do not have Java installed, then continue with the following steps.

  2. It is easiest to install Java on Linux using the preferred package manager of your Linux distribution. Here are some examples of how to install Java on common Linux distributions:

    • Ubuntu: sudo apt-get install openjdk-11-jdk

    • Fedora: sudo dnf install java-11-openjdk-devel

    • Arch: sudo pacman -S jdk11-openjdk

  3. Next, configure the default JVM version for your system:

    • Ubuntu: sudo update-alternatives --config java

    • Fedora: sudo alternatives --config java

    • Arch: archlinux-java set java-11-openjdk

  4. Configure JAVA_HOME and PATH environment variables for Java (or use a temporary configuration):

    1. Open the configuration file for your shell, which you can identify by typing echo $0. If the response is bash, open the file ~/.bashrc, and if it is sh, edit ~/.profile. You can look up config files for other shells by searching the name of the shell, followed by "config file" (ex. "zsh config file").

      • WSL users: WSL doesn’t automatically create these files, so you will need to create it. For example, if your shell is Bash, create the config file with touch ~/.bashrc.

    2. Go to the end of the config file, and add the following lines:

      export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")
      export PATH=$JAVA_HOME/bin:$PATH
    3. Run source <config file>, substituting in your config file, to load the changes into the terminal.

  5. Now run java --version again. You should now successfully see the Java 11 version that was installed.

Installing Maven

  1. First, let’s check if you already have Maven installed.

    1. Open a terminal, and run mvn -v.

    2. If the output shows a version number, Maven is already installed and you can jump to the Installing Git section. If you get command not found: mvn or a similar message indicating you do not have maven installed, then continue with the following steps.

  2. Either install Maven with your package manager, or go to this page and download the latest Binary zip archive (e.g, apache-maven-3.8.6-bin.zip).

    • Package manager:

      • Ubuntu: sudo apt-get install maven

      • Fedora: sudo dnf install maven

      • Arch: sudo pacman -S maven

    • Manual installation:

      1. Extract the distribution archive in any directory:

        unzip apache-maven-3.8.6-bin.zip
      2. Add the following to the end of the configuration file for your shell (or use a temporary configuration):

        export PATH=<path to Maven folder>/apache-maven-3.8.6/bin:$PATH
      3. Run source <config file>, substituting in your config file, to load the changes into the terminal.

  3. Now run mvn -v again. You should now successfully see the Maven version that was installed.

Installing Git

  1. First, let’s check if you already have Git installed.

    1. Open a terminal, and run git --version.

    2. If the output shows a version number, Git is already installed and you can jump to the Cloning WildFly Elytron section. If you get command not found: git or a similar message indicating you do not have Git installed, then continue with the following steps.

  2. It is easiest to install Git on Linux using the preferred package manager of your Linux distribution. Here are some examples of how to install Git on common Linux distributions:

    1. Ubuntu: sudo apt-get install git

    2. Fedora: sudo dnf install git

    3. Arch: sudo pacman -S git

  3. Now run git --version again. You should now successfully see the Git version that was installed.

  4. If you already had any IDEs open, close and reopen them now to load your changes.

Cloning WildFly Elytron

  1. First, configure Git so that it can attribute your commits to you. Run the following commands in the terminal, substituting your own name and email:

    git config --global user.email "<you@example.com>"
    git config --global user.name "<Your Name>"
  2. Next, you’ll need a GitHub account. If you don’t already have one, sign up for one at github.com. Otherwise, make sure you’re logged in.

  3. Fork the WildFly Elytron project into your GitHub account by clicking on the "Fork" button at the top right.

    Screenshot of buttons at top of wildfly-elytron repo, including "Fork" button
  4. Now go to your fork of the repository, the URL will be https://github.com//wildfly-elytron. Replace <USERNAME> with your GitHub username.

  5. At this point, you can follow the GitHub guide for adding a new SSH key to your GitHub account to set up an SSH key so you can clone your repository.

  6. At the top right, you will see there is a green "Code" button. Click on that and choose the "SSH" tab. Click on the button next to the url to copy it.

    Screenshot of options under "Code" button, under HTTPS tab.Default URL is https://github.com//wildfly-elytron.git
  7. Open your terminal and navigate to the directory where you want to clone this project. Then enter git clone [URL] and replace [URL] with the URL you copied in step 6. Now you should see a directory called wildfly-elytron that contains the code for the WildFly Elytron project.

  8. Next, add a remote reference to upstream, for pulling future updates from the source repository. Execute the following command in the terminal:

    cd wildfly-elytron
    git remote add upstream https://github.com/wildfly-security/wildfly-elytron.git

Building WildFly Elytron

  1. Open your terminal.

  2. Navigate to the wildfly-elytron project directory and run mvn clean install. This will build the project.

  3. Check out the Getting Started for Developers guide to learn more about the WildFly Elytron project and how to run tests.

Restoring Configuration

If you need to restore your original system configuration at some point, you can follow the steps here.