Skip to content

Compiling

Daniel Tischner edited this page Jul 14, 2018 · 8 revisions
Table of Contents

Overview

Compiling the backend can either be done manually or by using Apache Ant and the given build.xml.

Ant

To compile the backend using Apache Ant execute the build.xml. Available targets are

  • compile - Compiles all .java files in the src and test directory into .class files and stores them in a bin directory
  • test - Runs all files with a suffix of Test.java in the test directory using JUnit
  • checkstyle - Checks the style of all .java files in the src and test directory using Checkstyle
  • doc - Generates Javadoc for all classes in the src directory and stores it in a doc directory
  • jar - Generates several .jar files
    • xxx-src.jar - All .java files, including the tests
    • xxx-test.jar - All .class files, including the tests
    • xxx-doc.jar - The Javadoc packed in a jar
    • xxx.jar - Runnable backend, without any libraries, they need to be included on the classpath
    • xxx-standalone.jar - Runnable backend, including all libraries
  • clean - Deletes the bin and doc directory and all .jar files generated by the jar target
  • all - Executes the targets doc, test, checkstyle and jar

The simplest is to just navigate to the build.xml and execute

ant all

Dependencies

Cobweb has several dependencies on external libraries. They are all included in the backend/lib/ directory. For manual compilation all those libraries need to be on the classpath.

The directory is organized in the following way

  • base - Libraries needed to compile the application, excluding all test-files
    • commons-compress - Apache Commons Compress (1.16.1) for parsing compressed files like gz and xz
    • eclipse-collections - Eclipse Collections (9.1.0) for space and time optimizations
    • gson - GSON (2.8.4) for handling JSON in server requests and responses
    • jdbc-sqlite - SQLite JDBC (3.21.0) for connecting to an external database, can be exchanged by a different JDBC driver
    • lexiSearch - LexiSearch (1.0) for answering fuzzy prefix searches
    • logback - SLF4J (1.7.25) for logging and LogBack (1.2.3) as logger driver, can be exchanged by a different logger driver
    • onebusaway-gtfs - onebusaway-gtfs (1.3.4) for handling GTFS files
    • osm4j - osm4j-core (0.1.0) and osm4j-xml (0.1.1) for handling OSM files
  • misc - Libraries needed for additional tasks
    • checkstyle - Checkstyle (8.3) and its configuration file, needed for the checkstyle target of the build.xml
  • test - Libraries needed to compile the test-files
    • junit - JUnit (4.12) and Hamcrest (1.3) which are used by test-files and the test target of the build.xml