Skip to content

neoautus/lucidj-core

Repository files navigation

LucidJ Core

LucidJ core runtime, including kernel based on Apache Felix.

Prerequisites for Building

  • Java Development Kit 8 or later

  • Ant (minimun Ant 1.8.0)

Before Starting

The examples were built to illustrate both functionality and implementation. They are IDE-agnostic, showing all the steps to build an OSGi application from zero without need of a particular combination of IDE and plugin or any wizzard tool.

We achieve this using Ant. Today, you can also use Maven to build any OSGi project, however Maven is magical in it’s own way, because there are many predefined (and sane) defaults. You may choose Maven for your own projects. On the other side, Ant allows you to follow the logic of building an OSGi jar file, with all required steps very visible. We strongly suggest you to take a time to look into build.xml and configure.xml to get a good idea of whats going on, and how things are being done. It may look intimidating at first, but hopefully will also be instructive.

Specially, you will get known to Bnd (http://bndtools.org/), which is the reference tool to build all OSGi-related stuff you can imagine. There’s also the iPojo processor, which manipulates the code after compilation and demonstrates the post-processing of OSGi jar bundles.

Building

We suggest you to start building a stage, this stage may be a Felix or Karaf stage, Karaf stage will be built by default on build.xml. The stage area is where the bundles will be deployed, and every subproject will be tested individually.

To specific instructions to run the examples and the tests are available for each subproject on the README.adoc file.

To build all subprojects at once, just type ant on project root.

By default, Ant will download and cache all needed tools, then invoke the build-all target. The output of all builds will be located in dist/ directory beneath every subproject. Karaf stage, will be built by default, so all bundles will be deployed into Karaf. If you change the stage to Felix (changing the stage target to Felix all bundles will

Useful Ant targets

For details on building the code, see ant -p.

These are the available targets:

  • ant build-stage: build the stage with Apache Karaf ready to run the examples

  • ant build-library-version: build the Library Versioning subproject;

  • ant build-private-libraries: build the Private Libraries subproject;

  • ant build-rest-playground: build the Rest Playground subproject;

  • ant build-all: builds all available subprojects;

  • ant clean: removes the build and dist directories;

  • ant zero: same as clean, but also removes the cache directory with all downloaded tools;

  • ant configure: rebuild the library and tools cache.

Key Directories and Files

Important directories to be aware of:

  • cache - stores the downloaded jars, custom tasks and other tools;

  • stage - the local Apache Karaf installation built to test the subprojects.

The configure.xml file contains all the macros and targets used by the subprojects and it’s worth looking. It can be used standalone on another projects.

Installing Java on Raspberry Pi

Raspberry Pi have a fully certified OpenJDK distribution available: Zulu® Embedded, built by Azul Systems. You can install it on Raspbian Stretch using:

# apt-get install dirmngr
# apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0x219BD9C9
# echo 'deb http://repos.azulsystems.com/debian stable main' > /etc/apt/sources.list.d/zulu.list
# apt-get update
# apt-get install zulu-embedded-8
# java -version
openjdk version "1.8.0_152"
OpenJDK Runtime Environment (Zulu Embedded 8.25.0.76-linux-aarch32hf) (build 1.8.0_152-b76)
OpenJDK Client VM (Zulu Embedded 8.25.0.76-linux-aarch32hf) (build 25.152-b76, mixed mode, Evaluation)

Important Resources

If you need further information, please refer to the following resources:

This work is licensed under a Apache License, Version 2.0.