Last updated Jun 12, 2024

Building Confluence from source code

StatusLEGACY. This tutorial applies to Confluence versions that have reached end of life.

This guide describes building a confluence.war distribution or an IDE project from the Confluence source code. Plugin developers who wish to use source code as an aid in building plugins should refer to the plugin documentation. This process should be simple and quick, so please let us know if you get stuck.

Building a WAR distribution

  1. Download Confluence source code.

  2. Install restricted third party (.jar) libraries to your local Maven repository. 

    Confluence is built using Maven. Maven is bundled with the source distribution and therefore does not need to be installed separately. When you build Confluence, Maven will download dependencies and store them in a local repository. One of these dependencies requires manual installation for legal distribution reasons.

    Sun will not allow Maven to redistribute its binaries. You must install all Sun binaries manually by downloading them from Sun's website and running the mvn install command. Maven has provided documentation for both 3rd party jars in general and Sun jars in particular.

    1. For mail:
      Unzip the mail.jar file from the file. From the root of your extracted source code directory, run the following command, where Path/To/mail.jar is the absolute path to the extracted mail.jar file:

      ./ install:install-file -DgroupId=javax.mail -DartifactId=mail -Dversion=1.x.x -Dpackaging=jar -Dfile=Path/To/mail.jar -s "settings.xml" -Dmaven.repo.local="`pwd`/localrepo"

      Note: the filename of may differ depending on your version of Maven. 

    2. For oracle-jdbc15:
      From the root of your extracted source code directory, run the following command, where Path/To/oracle-jdbc15.jar is the absolute path to the oracle-jdbc15 file:

      ./ install:install-file -DartifactId=oracle-jdbc15 -Dversion= -Dpackaging=jar -Dfile=Path/To/oracle-jdbc15.jar -s "settings.xml" -Dmaven.repo.local="`pwd`/localrepo"

Option 1: Building the Confluence Project or Individual Libraries using IDEA

This is the simplest option. From IDEA, go to File >> Open Project. Browse to the pom.xml file of the individual project. If you are wanting to compile the Confluence project (as opposed to one of the libraries, say Atlassian User), use the pom.xml file from the confluence-project file.

Using the pom.xml at the root of the distribution to load the Confluence project and all its dependencies usually results in classloading errors. If you want to debug a dependency and the confluence core together, you'll have to integrate the projects.

Option 2: Building the Confluence Project or Individual Libraries Using Maven

Each Confluence Library is bundled with its own Maven pom file. To build one of the sub-projects, you need not build the entire source. To use the bundled maven distribution:

  1. Copy or build.bat to the appropriate sub-directory.

  2. Change M2_HOME to point to the parent directory, as so:

    export M2_HOME="$PWD/../maven"


    set M2_HOME=..\maven
  3. Run your build script.
    If the build is run successfully you should have a confluence.war file created in confluence-project/confluence-core/confluence-webapp/target

Building an Intellij Idea or an Eclipse project

  1. To build a project for an IDE, you can use the instructions above, but modify the or build.bat mvn command. Replace:

    exec mvn clean package -Dmaven.test.skip $* with:
    exec mvn idea:idea or exec mvn eclipse:eclipse

    A great way to open an IDEA module is to import the pom file from within IDEA. You can do it from File >> Open Project >> {browse to the pom file to import. You'll want to open the confluence-project pom or other module.

This should leave a project file in the root of your source directory. It should have all the confluence modules.

  1. Download Intellij IDEA.

  2. Install Tomcat and get it running.

  3. In your Confluence source tree, edit confluence-project/conf-webapp/src/main/resources/ Set your home directory.

  4. From Preferences > Application Servers add Tomcat

  5. From Run > Edit Configurations, add a Tomcat Configuration. Select to deploy the confluence-webapp module to the appserver:

  6. Click Configure and configure how to deploy. Choose to Create web module exploded directory and exclude from module content:

  7. From the server tab, you might set some memory settings like:

    -XX:MaxPermSize=256M -Xmx512m
  8. Run the application. Have fun!

Creating a Single Patch File

If you'd like to create a patch:

  1. If you haven't done so, select Build >> Make Project.
  2. Select Build >> Compile '<class name>.java'

This will leave a compiled class file in the <confluence-source distribution>/confluence-project/confluence/target/classes/<path-to-class> where the path to class is the package of the class you've compiled.

Creating a Server for Eclipse

In Eclipse creating a server defines creating a pointer to an existing installation of an application server.
To create a server:
Window->Show View->Servers
Right Click and select New->Server
In the menu bar click File->New->Other and expand the server folder and select the version of the serer you have installed on your system.
Click Next and the New Server wizard opens.  This wizard defines a new server, that contains information required to point to a specific runtime environment for local or remote testing, or for publishing to an application server. By default, this field is pre-filled with the default address: localhost

Supported Servers in Eclipse:

  1. Eclipse view after adding Tomcat

Troubleshooting and Technical Support

If you get a class not found error, you may need to replace a jar file in your maven repository. Try Atlassian Answers.

Atlassian encourages our community to make use of our source code. Please be aware that upgrades may require additional modifications.

Source code modifications are not supported by Atlassian Support.

Rate this page: