Skip to content

Latest commit

 

History

History
165 lines (121 loc) · 4.4 KB

File metadata and controls

165 lines (121 loc) · 4.4 KB

Building TreeBASE

This document describes how to compile and package the TreeBASE artifacts.

Prerequisites

Java 17 LTS

Java 17 is required for building TreeBASE. Verify your installation:

$ java -version
openjdk version "17.0.9" 2023-10-17
OpenJDK Runtime Environment (build 17.0.9+9-Ubuntu-120.04)
OpenJDK 64-Bit Server VM (build 17.0.9+9-Ubuntu-120.04, mixed mode, sharing)

Installing Java 17

Linux (Ubuntu 20.04 LTS or later):

sudo apt-get update
sudo apt-get install openjdk-17-jdk

Windows and macOS: Download from Adoptium Temurin or Oracle JDK

Maven

Ensure Maven is installed:

$ mvn -V
Apache Maven 3.8.7
Maven home: /usr/share/maven
Java version: 17.0.9, vendor: Ubuntu
Java home: /usr/lib/jvm/java-17-openjdk-amd64

Note: If you get a message about JAVA_HOME not being set, reinstall the full JDK (not just JRE):

sudo apt install openjdk-17-jdk

On Windows you might need to create this environment variable JAVA_HOME and set it to the installation location of Java.

If Maven is not installed:

sudo apt install maven

or on Windows goto the download section mavenapache.org
download the Binary zip archive
extract to a folder on your machine, say 'c:\Program Files (X86)\apache-maven-3.9.x'
add 'c:\Program Files (X86)\apache-maven-3.9.x\bin' to your path variables (note the addition of bin!)
start terminal and type mvn

Git

$ git --version
git version 2.7.4

Install if needed:

sudo apt install git

Building the Artifacts

1. Clone the Repository

git clone https://github.com/TreeBASE/treebase.git
cd treebase

2. Compile

Compile all modules using the compiler:compile Maven goal:

mvn compiler:compile

Successful build output:

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] Treebase ........................................... SUCCESS [  0.396 s]
[INFO] treebase-core ...................................... SUCCESS [  3.234 s]
[INFO] treebase-web ....................................... SUCCESS [ 11.620 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

3. Configure Database Connection

Before packaging, copy and configure the database connection files:

  1. Core JDBC configuration:

    cp treebase-core/src/main/resources/jdbc.properties.example \
       treebase-core/src/main/resources/jdbc.properties

    Edit jdbc.properties with your database credentials.

  2. Web application context:

    cp treebase-web/src/main/webapp/META-INF/context.xml.example \
       treebase-web/src/main/webapp/META-INF/context.xml

    Edit context.xml with your database credentials and Mesquite folder location.

Note: Current configuration values are stored in the private repository TreeBASE/treebase-config.

4. Package the WAR

Create the deployable WAR file:

mvn package -Dmaven.test.skip=true

Successful packaging output:

[INFO] Packaging webapp
[INFO] Assembling webapp [treebase-web] in [/path/to/treebase/treebase-web/target/treebase-web]
[INFO] Building war: /path/to/treebase/treebase-web/target/treebase-web.war
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

Build Artifacts

The build produces:

treebase-web.war (~59MB)

Located at: treebase-web/target/treebase-web.war

This WAR contains:

  • Compiled classes from treebase-web
  • Compiled classes from treebase-core (bundled as JAR in WEB-INF/lib/)
  • All dependency JARs
  • Configuration files (context.xml, jdbc.properties)
  • Web assets (HTML, JSP, CSS, JavaScript)

Project Structure

The build operates on these subprojects:

Next Steps

After building, see DEPLOYING.md for deployment instructions.