You need a JDK 8 or higher installed on your machine. To determine the JDK to run upon, jeka looks in priority order :
- JEKA_JDK environment variable ([JEKA_JDK]/bin/java must point on java executable)
- JAVA_HOME environment variable
- java executable accessible from PATH environment variable.
Jeka organization provides a plugin for IntelliJ in order to make the following tasks useless.
Here, we'll focus only on how to do it using command line only.
There are two ways of using jeka : by installing Jeka itself or by using a project already containing the Jeka wrapper.
Install Jeka Distribution¶
It is not required to install Jeka distribution to use it. If you fetch a project already holding a wrapper, using
jekaw would be enough.
Nevertheless, if you want to create project from scractch, it will be required.
- Download the latest release from here and unpack the distrib.zip wherever you want on your machine. We'll refer to this directory as [JEKA HOME].
- Add [JEKA HOME] to your PATH environment variable.
- Now, you can use
jekacommand from everywhere.
Projects with Jeka Wrapper¶
For working on a project already holding a Jeka wrapper, there is no need to install Jeka :
- Fetch the project from its remote repository
jekawcommand from project root path.
To start from an empty project, clone template blank project from https://github.com/jerkar/jeka-wrapper-project-template.git
- Add an IDE path variable JEKA_USER_HOME pointing on [USER HOME]/.jeka. In Intellij : Settings... | Appearance & Behavior | Path Variables
- If you use
jekaw, add an IDE path variable JEKA_HOME pointing on [JEKA HOME].
Hello World Project¶
For simplicity's sake, we'll use trivial example just displaying a message on console.
Create Project Structure¶
- Create the root dir of the project or use the template wrapper project mentioned above.
- At project root, execute
jeka scaffold#run scaffold#wrapper(or just
jekaw scaffold#runif using the template wrapper project).
jeka eclipse#filesin order to generate IDE configuration file.
- The project with a Jeka structure and a basic build class is ready to work within your IDE
Create a Jeka Method¶
Jeka methods require to be zero-args instance methods returning
Modify the def/Build.java file to ad hello method as follow.
jeka hello to see message displayed on console.
Optionally, we can use a classical
main method to launch it from the IDE.
Get Contextual Help¶
jeka -h (or
jeka -help) to display a contextual help on the console.
Follow instructions to navigate to more specific help context.
Do not confuse
jeka -help and
jeka help. The last provides only documentation about the default KBean.
For any reasons, we might like to use different location than the standard ones for Jeka User Home and Jeka Cache.
We can change the location using following OS environment variable :
JEKA_USER_HOME: to set the Jeka User Home to a specified location (absolute path).
JEKA_CACHE_DIR: to set the cache (mainly all downloaded files), to a specified location (also absolute file)