Setting up WildFly Elytron on macOS
This page will guide you through the steps needed to setup a development environment for WildFly Elytron on macOS.
Installing Java
-
First, let’s check if you already have Java installed.
-
Open a terminal and run
java --version
. -
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.
-
-
It is easiest to install Java using the Homebrew package manager. (If you’d prefer to install Java manually, check out this guide.)
-
If you don’t already have brew installed, run the following command:
/bin/zsh -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
-
If you run
brew -v
and you get an error, you need to add Homebrew to your path. The output of the Homebrew installation will give you the commands needed to add to your path.
-
-
Install Java:
brew install java11
-
Now run the following command to check if the Java installation was successful:
brew search java
-
Look for
java11
listed under theFormulae
section with a green checkmark next to it.
-
-
Next we need to create a symbolic link so the system java wrappers can find it and add the path to
JAVA_HOME
to the environment variables. To do that, first run the following command:brew info java11
-
The output will be something like this:
For the system Java wrappers to find this JDK, symlink it with sudo ln -sfn /usr/local/opt/openjdk@11/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-11.jdk openjdk@11 is keg-only, which means it was not symlinked into /usr/local, because this is an alternate version of another formula. If you need to have openjdk@11 first in your PATH, run: echo ‘export PATH=”/usr/local/opt/openjdk@11/bin:$PATH”’ >> ~/.zshrc
-
Follow the instructions from the output you receive to create the symbolic link and add the path to the environment variables.
-
Lastly, run
source <config file>
, substituting in your config file, to load the changes into the terminal.
-
-
Now run
java --version
again. You should now successfully see the Java 11 version that was installed.
Installing Maven
-
First, let’s check if you already have Maven installed.
-
Open a terminal, and run
mvn -v
. -
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.
-
-
It is easiest to install Maven using the Homebrew package manager. (If you’d prefer to install Maven manually, check out this guide. Also consider a temporary configuration.)
brew install maven
-
Now run
mvn -v
again. You should now successfully see the Maven version that was installed.
Installing Git
-
First, let’s check if you already have Git installed.
-
Open a terminal and run
git --version
. -
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.
-
-
It is easiest to install git using the Homebrew package manager. (If you’d prefer to install using a different approach, there are some more options here.)
brew install git
-
Now run
git --version
again. You should now successfully see the Git version that was installed. -
If you already had any IDEs open, close and reopen them now to load your changes.
Cloning WildFly Elytron
-
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>"
-
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.
-
Fork the WildFly Elytron project into your GitHub account by clicking on the "Fork" button at the top right.
-
Now go to your fork of the repository, the URL will be https://github.com//wildfly-elytron. Replace
<USERNAME>
with your GitHub username. -
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.
-
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.
-
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 calledwildfly-elytron
that contains the code for the WildFly Elytron project. -
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
-
Open a terminal.
-
Navigate to the wildfly-elytron project directory and run
mvn clean install
. This will build the project. -
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.