Skip to content

Building

yassinezerguine08 edited this page Oct 30, 2026 · 3 revisions

Building and packaging

Building Oriel

Oriel needs Java 25. Build and test it with the Maven wrapper:

./mvnw verify      # build and run the tests
./mvnw install     # also put the jars in the local Maven repository, for an application to use

It builds three artifacts. A local install names them with the group org.unigrid.oriel, and JitPack with com.github.unigrid-project.oriel:

Artifact What it is
oriel-server The server, actions, views and templates
oriel-server with <type>test-jar</type> The test helpers; see Testing an application
oriel-window The window; it brings oriel-server with it

A release is made by pushing a tag such as v0.0.2 from master. That leaves a draft release with the jars, which is published from the Releases page. Publishing it also tags the same commit 0.0.2, without the v, because JitPack takes the tag as the Maven version and Maven wants one that starts with a digit; applications name that one. Applications fetch a released version through JitPack, which builds it from the tag with the Java set in jitpack.yml; see Getting started.

Running an application in development

Run the application's main from the IDE or with the exec-maven-plugin. The browser engine is downloaded into ~/.<id>/jcef on the first start.

Chromium reaches into the JDK's window classes, so the JVM needs some options. On macOS, pass these, for example in .mvn/jvm.config:

--enable-native-access=ALL-UNNAMED
--add-opens=java.desktop/sun.awt=ALL-UNNAMED
--add-opens=java.desktop/sun.java2d=ALL-UNNAMED
--add-opens=java.desktop/sun.lwawt=ALL-UNNAMED
--add-opens=java.desktop/sun.lwawt.macosx=ALL-UNNAMED

Also start it with -Dsun.java2d.metal=false on macOS. The JDK's Metal pipeline crashes the application when a display goes away, such as a monitor that sleeps or is unplugged, and the page is drawn by Chromium anyway, so the older OpenGL pipeline costs nothing noticeable. It is a JVM option rather than something Oriel sets, so the launcher decides it and -Dsun.java2d.metal=true turns Metal back on.

Packaging, with Janus as the worked example

Janus, the Unigrid wallet, is an application built on Oriel. Its modules divide the work the way any Oriel application can:

Module What it holds
core What the application does, with no interface
ui Controllers with @Action methods, views, and the templates and static files under templates/ and static/
shell Janus.main: it reads the command line, builds the Application, starts the server and opens the BrowserWindow, like Getting started
desktop The installers

Bundling the browser engine

So that an installed application starts without a download, desktop fetches the engine at build time into the folder the installer carries. Its PrepareCef runs in prepare-package:

public static void main(final String[] arguments) throws Exception {
	final CefAppBuilder builder = new CefAppBuilder();

	builder.setInstallDir(new File(arguments[0]));
	builder.setProgressHandler(new ConsoleProgressHandler());
	builder.install();
}

The launcher then names that folder with the property built from the application's id, here janus:

<option>-Djanus.jcef=$APPDIR/jcef</option>

With the property set, Oriel uses the bundled engine and never downloads one; see The window.

The installers

desktop packages with jpackage through org.panteleyev:jpackage-maven-plugin:

  • An app image on every platform.
  • An MSI on Windows and a DMG on macOS, from profiles that switch on by operating system.

The parts that matter for Oriel:

<mainJar>shell-${project.version}.jar</mainJar>
<mainClass>org.unigrid.janus.shell.Janus</mainClass>
<addModules>
	<addModule>java.base</addModule>
	<addModule>java.desktop</addModule>
	<addModule>java.instrument</addModule>
	<addModule>java.management</addModule>
	<addModule>java.naming</addModule>
	<addModule>java.net.http</addModule>
	<addModule>java.sql</addModule>
	<!-- jdeps cannot see modules that are found through service lookup: the window toolkit loads
	     jdk.accessibility for screen readers, and Jetty reads its stylesheets out of the jar through jdk.zipfs. -->
	<addModule>jdk.accessibility</addModule>
	<addModule>jdk.unsupported</addModule>
	<addModule>jdk.zipfs</addModule>
</addModules>
<javaOptions>
	<option>--add-opens</option>
	<option>java.base/java.lang=ALL-UNNAMED</option>
	<option>--enable-native-access=ALL-UNNAMED</option>
	<option>-Djanus.jcef=$APPDIR/jcef</option>
</javaOptions>

On macOS the launcher also needs these:

  • --add-exports for java.desktop/sun.awt, java.desktop/sun.lwawt and java.desktop/sun.lwawt.macosx.
  • -Dsun.java2d.metal=false, because the JDK's Metal pipeline crashes when a display goes away.

The build copies the application's jars into one input folder with maven-dependency-plugin before jpackage runs. See desktop/pom.xml in janus-java for the whole of it.

Clone this wiki locally