|
| 1 | +--- |
| 2 | +title: Building from Source |
| 3 | +parent: Getting Started |
| 4 | +has_children: false |
| 5 | +nav_order: 10 |
| 6 | +layout: default |
| 7 | +--- |
| 8 | + |
| 9 | +# Building RPT from Source |
| 10 | + |
| 11 | +The build requires maven. |
| 12 | + |
| 13 | +For convenience, a [Makefile](https://github.com/SmartDataAnalytics/RdfProcessingToolkit/blob/develop/Makefile) which defines essential goals for common tasks. |
| 14 | +To build a "jar-with-dependencies" use the `distjar` goal. The path to the created jar bundle is shown when the build finishes. |
| 15 | +In order to build and and install a deb or rpm package use the `deb-rere` or `rpm-rere` goals, respectively. |
| 16 | + |
| 17 | +``` |
| 18 | +$ make |
| 19 | +
|
| 20 | +make help # Show these help instructions |
| 21 | +make distjar # Create only the standalone jar-with-dependencies of rpt |
| 22 | +make rpm-rebuild # Rebuild the rpm package (minimal build of only required modules) |
| 23 | +make rpm-reinstall # Reinstall rpm (requires prior build) |
| 24 | +make rpm-rere # Rebuild and reinstall rpm package |
| 25 | +make deb-rebuild # Rebuild the deb package (minimal build of only required modules) |
| 26 | +make deb-reinstall # Reinstall deb (requires prior build) |
| 27 | +make deb-rere # Rebuild and reinstall deb package |
| 28 | +make docker # Build Docker image |
| 29 | +make release-bundle # Create files for Github upload |
| 30 | +``` |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | +A docker image is available at https://registry.hub.docker.com/r/aksw/rpt |
| 35 | + |
| 36 | +The docker image can be built with a custom tag by setting the property `docker.tag`. |
| 37 | +The default for `docker.tag` is `${docker.tag.prefix}${project.version}`, where `docker.tag.prefix` defaults to the empty string. |
| 38 | +When only setting `docker.tag.prefix` to e.g. `myfork-` then the tag will have the form `myfork-1.2.3-SNAPSHOT`. |
| 39 | + |
| 40 | +```bash |
| 41 | +make docker |
| 42 | + |
| 43 | +# Set a custom prefix to which the version will be appended: |
| 44 | +make docker ARGS='-D"docker.tag.prefix=experimental-"' |
| 45 | + |
| 46 | +# Set the tag to a specific value |
| 47 | +make docker ARGS='-D"docker.tag=latest-dev"' |
| 48 | +``` |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | +## JVM Options |
| 53 | + |
| 54 | +Since Java 17, RPT requires a set of `--add-opens` declarations in order for all of its various aspects to function correctly. These declarations are shown below. RPT's package builds (such as `.deb`, `.rpm`, `docker`) already include these declarations. However, when you build the jar bundle yourself, you need to add those declarations to the launcher. |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | +```bash |
| 59 | +#!/bin/sh |
| 60 | + |
| 61 | +MAIN_CLASS="org.aksw.rdf_processing_toolkit.cli.main.MainCliRdfProcessingToolkit" |
| 62 | + |
| 63 | +# Extra options for Java 17; Source: |
| 64 | +EXTRA_OPTS="--add-opens=java.base/java.lang=ALL-UNNAMED \ |
| 65 | + --add-opens=java.base/java.lang.invoke=ALL-UNNAMED \ |
| 66 | + --add-opens=java.base/java.lang.reflect=ALL-UNNAMED \ |
| 67 | + --add-opens=java.base/java.io=ALL-UNNAMED \ |
| 68 | + --add-opens=java.base/java.net=ALL-UNNAMED \ |
| 69 | + --add-opens=java.base/java.nio=ALL-UNNAMED \ |
| 70 | + --add-opens=java.base/java.util=ALL-UNNAMED \ |
| 71 | + --add-opens=java.base/java.util.concurrent=ALL-UNNAMED \ |
| 72 | + --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED \ |
| 73 | + --add-opens=java.base/sun.nio.ch=ALL-UNNAMED \ |
| 74 | + --add-opens=java.base/sun.nio.cs=ALL-UNNAMED \ |
| 75 | + --add-opens=java.base/sun.security.action=ALL-UNNAMED \ |
| 76 | + --add-opens=java.base/sun.util.calendar=ALL-UNNAMED \ |
| 77 | + --add-opens=java.security.jgss/sun.security.krb5=ALL-UNNAMED" |
| 78 | + |
| 79 | +SCRIPTING_OPTS="-Djena:scripting=true -Dnashorn.args=--language=es6" |
| 80 | + |
| 81 | +java $SCRIPTING_OPTS $JAVA_OPTS -jar rpt-jar-with-dependencies.jar "$MAIN_CLASS" "$@" |
| 82 | + |
| 83 | +``` |
| 84 | + |
0 commit comments