Openfire Source Code in Visual Studio Code IDE

This is a short tutorial on how to load the Openfire source code in the Visual Studio Code IDE.

This guide provides detailed information for developers that wish to make changes, compile and run the Openfire source code by using Visual Studio Code IDE.

For additional developer resources please visit: http://www.igniterealtime.org. The Openfire build process is based on Apache Maven. Visit the Maven website for more information.

Visual Studio Code or VS Code is a fast editor and ships with great editing features. It includes support for debugging, embedded Git control, syntax highlighting, intelligent code completion, snippets and code refactoring. In part thanks to the huge ecosystem of extensions that enhance and enrich the experience in VS Code, turning it into a super smart text editor, fast and lightweight. This guide focuses on the bare minimum that is needed to get started Openfire source code with VS Code.

Prepare your environment

The rest of this guide will assume you have at least those parts installed:

Start by Adding Java language support to VS Code by installing the popular minimum requirement Java extensions. There is a Java Extension Pack, which contains the most popular extensions for most Java developers:

Launch your VS Code and bring up extensions view by clicking on the Extensions icon in the Activity Bar on the left side of VS Code or View > Extensions then write the name of extension Java Extension Pack and then click on install link to install all extensions for Pack.

Installing Java Extension Pack to VS Code.
Installing Java Extension Pack to VS Code.

Open the source code folder

The Openfire source code is using an Apache Maven project structure. As VS Code (with Maven Extension) recognizes this structure, opening the source code into an VS Code project is very easy.

Select the 'Open' option -- File > Open and choose your Openfire source code folder then click on the open button. This will quickly import the Openfire source code into VS Code .

Use the 'Open' functionality of VS Code. Select the folder that will open in our VS Code. Overview of project in Visual Studio Code
Opening Openfire Source folder on VS Code.

VS Code will automatically recognize and process the Maven structure of Openfire (pom.xml file) and it will automatically download all dependencies.

Build Openfire from VS Code

The following instructions will explain how you can build Openfire from the code that is in the VS Code workspace.

Select the 'New Terminal' option -- Terminal > New Terminal to open a terminal and run the command bellow to build the complete project including plugins:

This will quickly build Openfire (compile and run all unit tests) and create a distributable package in the distribution/target/ folder.

Build Openfire from the source code.

Run Openfire from VS Code

When developing, it is often also useful to run the code straight from your IDE. You can launch Openfire using the scripts in distribution/target/distribution-base/bin using the terminal in VS Code.

Launch Openfire server  using shell script. The Openfire startup screen after launching the server.
Run Openfire straight from the source code.

After running Openfire you can go to your server using the URL shown in console (or http://localhost:9090) and configure it.