Skip to content

Building OmegaT

OmegaT is built with Gradle. Run gradlew tasks from the top level to see the available tasks. Run gradlew build to build all possible distfiles and run the main tests. Tasks skipped due to missing requirements will be noted in the output.

OmegaT will run on the latest Java, but is required to be compatible with Java 11.

Eclipse and NetBeans are recommended IDEs for working with OmegaT source code. NetBeans is required to modify *.form-based GUI layouts (install the Gradle Support plugin to open the OmegaT project in NetBeans.)

Check the other files in this directory for documentation. You can produce Javadoc by running gradlew javadoc, or browse online:

https://omegat.sourceforge.io/javadoc-latest/

Prerequisite

As of Dec. 2023, here are the requirements to build OmegaT binaries;

  1. Java Development kit 11 or later. When you want to build a Linux deb/rpm package, JDK 17 or later is required.
  2. Requires docker or nerdctl command to launch containerized processes. Build process for documentation and windows packages will be skipped when neither docker nor nerdctl command is not found.
  3. JDK 21 has not been supported yet to launch Gradle build tool, but it works well as an OmegaT runtime.

Configuring Build Tasks

Some build tasks, such as signed installers, require additional configuration via a local.properties file placed at the root of the source tree. See local.properties.example.

When specified a Gradle property forceSkipDocumentBuild, the build task will skip build processes to generate greeting documents, FirstStep.html in languages, and bundled manuals. You can edit local.properties or

Build Assets

Some build tasks require the user to supply additional files not included in the OmegaT source. These files should be placed in the assets directory, which by default is .., i.e. one level up from the OmegaT source root. You can specify a different directory by supplying the argument -PassetDir=/path/to/wherever.

In particular, with-JRE builds require a JRE tarball for the appropriate platform, e.g. OpenJDK11U-jre-*-macosx-x64.tar.gz.

Containerized Tasks

Some build tasks require additional software to be installed:

Working with Dependencies

OmegaT uses Gradle to manage and fetch dependencies automatically. To add, change, or remove a dependency, see the dependencies block in build.gradle.

Dependency JARs are provided in the "source" distribution of OmegaT under /lib/provided, as insurance in case any dependencies should become unavailable online. When /lib/provided is present, compile-time dependencies will be resolved locally, minimizing network access (network access is still required for initializing the Gradle wrapper, fetching Gradle plugins, and fetching test dependencies).

Customized Dependencies

OmegaT uses unmodified packages as much as possible, but when modifications are required and the upstream project is abandoned or unresponsive, custom-patched libraries are also used.

Patched forks can be found on GitHub: https://github.com/omegat-org

In some cases (especially defunct projects) OmegaT forks are also published for general use on Maven Central: https://search.maven.org/search?q=g:org.omegat*

Dependencies not available for consumption via Maven/Gradle are committed to /lib/manual.

Basic build tasks

You can see defined tasks by running ./gradlew tasks at the root of the project. If you use IDEs that support Gradle, such as Eclipse, Apache NetBeans or Jetbrains IntelliJ, they will show you the list of available tasks.

------------------------------------------------------------
Tasks runnable from root project 'OmegaT'
------------------------------------------------------------

Application tasks
-----------------
debug - Launchs app for debugging.
run - Runs this project as a JVM application
runOnJava17 - Launches app on Java 17
runOnJava21 - Launches app on Java 21

Build tasks
-----------
assemble - Assembles the outputs of this project.
build - Assembles and tests this project.
buildDependents - Assembles and tests this project and all projects that depend on it.
buildNeeded - Assembles and tests this project and all projects it depends on.
classes - Assembles main classes.
clean - Deletes the build directory.
jar - Assembles a jar archive containing the classes of the 'main' feature.
javaClasses - Assembles java classes.
javadocJar - Assembles a jar archive containing the main javadoc.
sourcesJar - Assembles a jar archive containing the main sources.
testClasses - Assembles test classes.
testFixturesClasses - Assembles test fixtures classes.
testFixturesJar - Assembles a jar archive containing the classes of the 'testFixtures' feature.
testIntegrationClasses - Assembles test integration classes.

Build Setup tasks
-----------------
init - Initializes a new Gradle build.
wrapper - Generates Gradle wrapper files.

Distribution tasks
------------------
assembleDist - Assembles the main distributions
assembleSourceDist - Assembles the source distributions
distTar - Bundles the project as a distribution.
distZip - Bundles the project as a distribution.
installDist - Installs the project as a distribution as-is.
installLinux64Dist - Creates a Linux installDist for linux64. 
installLinuxArm64Dist - Creates a Linux installDist for linuxArm64. 
installSourceDist - Installs the project as a distribution as-is.
linuxDebDist
linuxRpmDist
macArmInstallDist - Builds a Mac distribution.
macArmInstallSignedDist - Builds a signed Mac distribution. Requires an Apple Developer Account.
macX64InstallDist - Builds a Mac distribution.
macX64InstallSignedDist - Builds a signed Mac distribution. Requires an Apple Developer Account.
sourceDistTar - Bundles the project as a distribution.
sourceDistZip - Bundles the project as a distribution.

Documentation tasks
-------------------
firstSteps - Builds the First Steps HTML pages for all languages at docs/greetings/. Requires Docker.
genDocIndex - Generates the docs index file
javadoc - Generates Javadoc API documentation for the 'main' feature.
manualHtmls - Builds HTML manuals and zip for all languages. Requires container runtime.
manualPdfs - Builds PDF manuals for all languages. Requires container runtime.
manualZips - Builds ZIP manuals to bundle into the application. Requires container runtime.
testFixturesJavadoc - Generates Javadoc API documentation for the 'testFixtures' feature.
updateManuals - Updates Instant Start guides and HTML manuals.
-> we don't have the Instant Start anymore. What does this do?
webManual - Syncs the HTML manual files
-> syncs from where to where?

Gradle Enterprise tasks
-----------------------
buildScanPublishPrevious - Publishes the data captured by the last build.
provisionGradleEnterpriseAccessKey - Provisions a new access key for this build environment.

Help tasks
----------
buildEnvironment - Displays all the build scripts dependencies declared in root project 'OmegaT'.
dependencies - Displays all the dependencies declared in root project 'OmegaT'.
dependencyInsight - Displays the insight into a specific dependency in root project 'OmegaT'.
dependencyUpdates - Displays the dependency updates for the project.
help - Displays a help message.
javaToolchains - Displays the detected java toolchains.
outgoingVariants - Displays the outgoing variants of root project 'OmegaT'.
projects - Displays the sub-projects of root project 'OmegaT'.
properties - Displays the properties of root project 'OmegaT'.
resolvableConfigurations - Displays the configurations that can be resolved in root project 'OmegaT'.
tasks - Displays the tasks runnable from root project 'OmegaT' (some of the displayed tasks may belong to subprojects).

IDE tasks
---------
cleanEclipse - Cleans all Eclipse files.
eclipse - Generates all Eclipse files.

Launch4j tasks
--------------
createAllExecutables - Runs all tasks that implement DefaultLaunch4jTask
createExe - Runs the launch4j jar to generate an .exe file

Omegat distribution tasks
-------------------------
Linux - Builds the Linux distributions.
linux64DistTarBz - Creates a Linux distribution for linux64. 
linuxArm64DistTarBz - Creates a Linux distribution for linuxArm64. 
mac - Builds the Mac distributions.
macArmDistZip - Creates a Mac distribution for macArm
macArmSignedDistZip
macX64DistZip - Creates a Mac distribution for macX64
macX64SignedDistZip
win - Builds the Windows distributions.
winJRE64Signed
winJRESigned
winNoJRESigned

Omegat release tasks
--------------------
publishJavadoc - Copies javadoc to SourceForge web.
publishManual - Copies manual to SourceForge web.
publishVersion - Updates the version considered current by the version check.

Omegat workflow tasks
---------------------
spotlessChangedApply - Applies code formatting to files that have been changed on the current branch.
testIntegration - Runs integration tests. Pass repo URL as -Domegat.test.repo=<repo>

Publishing tasks
----------------
generateMetadataFileForMavenJavaPublication - Generates the Gradle metadata file for publication 'mavenJava'.
generatePomFileForMavenJavaPublication - Generates the Maven POM file for publication 'mavenJava'.
publish - Publishes all publications produced by this project.
publishAllPublicationsToMavenRepository - Publishes all Maven publications produced by this project to the maven repository.
publishMavenJavaPublicationToMavenLocal - Publishes Maven publication 'mavenJava' to the local Maven repository.
publishMavenJavaPublicationToMavenRepository - Publishes Maven publication 'mavenJava' to Maven repository 'maven'.
publishToMavenLocal - Publishes all Maven publications produced by this project to the local Maven cache.

Verification tasks
------------------
check - Runs all checks.
jacocoTestCoverageVerification - Verifies code coverage metrics based on specified rules for the test task.
jacocoTestReport - Generates code coverage report for the test task.
spotbugsJava - Runs SpotBugs analysis for the source set 'java'
spotbugsMain - Runs SpotBugs analysis for the source set 'main'
spotbugsMainReport
spotbugsTest - Runs SpotBugs analysis for the source set 'test'
spotbugsTestFixtures - Runs SpotBugs analysis for the source set 'testFixtures'
spotbugsTestIntegration - Runs SpotBugs analysis for the source set 'testIntegration'
spotbugsTestReport
spotlessApply - Applies code formatting steps to sourcecode in-place.
spotlessCheck - Checks that sourcecode satisfies formatting steps.
spotlessDiagnose
spotlessJava
spotlessJavaApply
spotlessJavaCheck
spotlessJavaDiagnose
test - Runs the test suite.
testOnJava17 - Runs the test cases on Java 17
testOnJava21 - Runs the test cases on Java 21

Other tasks
-----------
jpackage

Rules
-----
Pattern: clean<TaskName>: Cleans the output files of a task.
Pattern: build<ConfigurationName>: Assembles the artifacts of a configuration.

Most tasks are accompanied by an explanatory sentence.

I want to run OmegaT with some modification

There are two major ways to build and execute OmegaT from source.

  1. use application tasks

The tasks are run, runOnJava17 and runOnJava21. They will compile the core of OmegaT, all the modules, the First Steps documents, place module jars in the build/modules folder and launch the main function from source. You can add command line arguments to the Gradle command with --args="argument value".

Example:

./gradlew run --args="-Xmx4096M --add-opens java.desktop/sun.awt.X11=ALL-UNNAMED  -Duser.language=ja -Duser.country=JP"
2. use installDist task

When running installDist task, the OmegaT build system compiles the core of OmegaT, all the modules, the first step pages, all the bundled manuals, and copies the files with installed structure in build/install/OmegaT/.

What is "with installed structure"?

You can open a terminal in the folder, and launch OmegaT from there.

Example:

./gradlew installDist

cd build/install/OmegaT/
./OmegaT

I want to build a specific module

You can use the module::task syntax to build the jar file for a specific module.

Example:

./gradlew aligner:jar

When the build is finished, the aligner-omegat.jar file will be found in build/modules/.

I want to build HTML manual in my language

There are manualHtmlXX tasks, here XX is a 2-letter language code such as En, Ca, Fr. When you want to build html manuals in all supported languages, use manualHtlms instead.

Quick OmegaT project building

We provide several ways and technics to speed up the build-and-try cycles.

Skip containerized manual build

If you don't need to build the HTML manuals, you have 2 options:

  1. If the container support software is not installed, the document building is always skipped.
  2. You can use the -PforceSkipDocumentBuild property in Gradle command line to skip the documentation building. -> we need a third option where the container software is not running.

The task execution log will record the reason why the manuals building was skipped with the "SKIPPED" label.

Smart task execution

The OmegaT build system is configured to use Gradle task smart build features. Once you run a build task, such as making a jar, the HTML manuals, and then modified some code, Gradle will skip all the unchanged parts of the project, and only compile and generate the required jar. You will see explanatory labels in a build log. These labels are based show if a task has actions to execute, if it should execute those actions, if it did execute those actions and if those actions made any changes.

  • (no label) or EXECUTED

    Task executed its actions.

  • UP-TO-DATE

    Task’s outputs did not change.

  • FROM-CACHE

    Task’s outputs could be found from a previous execution.

  • SKIPPED

    Task did not execute its actions.

  • NO-SOURCE

    Task did not need to execute its actions.

Modular architecture

The OmegaT project source tree is configured as a multi-project format. When building OmegaT, the Gradle build system runs compilation and other tasks concurrently among the subprojects. OmegaT has several modules which are bundled plugins, that are handled in a parallel way. Gradle will use as many cores as the computer has.