Jeka follows a specific process before invoking KBean methods :

  1. Parse command line and set arguments specified as -Dxxx=yyy as system properties.
  2. Set [project dir] = current working dir
  3. Augment the current classloader with jar files found in [project dir]/jeka/boot
  4. Augment the current classloader with resolved coordinates mentionned in command line as @group:name:version
  5. Parse source files contained in project dir/jeka/def
    1. Detect @JkInjectProject annotations. For each :
      1. Set [project dir] to value declared in annotation
      2. Process steps 3, 4, 5, 6 for the injected project
    2. Augment the current classloader with dependencies declared in source files
  6. Compile files in [project dir]/def/jeka and augment current classloader with compiled files
  7. If the compilation fails and the command-line option -dci is present, ignore it.
  8. Scan classloader classpath to find KBeans and associate each KBean referenced in the command line.
  9. Identify the default KBean if available. The default KBean is the first class found in [project dir]/jeka/def extending JkBean.
  10. Instantiate the default KBean. Instantiate means :
    1. Invoke no-arg constructor
    2. Inject KBean properties mentioned in command line
  11. Instantiate other KBean, if not yet done by order they appear in the command line.

Once KBeans have been instantiated, KBean methods are executed in the order in which they appear in the command line.


There is only one KBean instance by KBean class and by project.


JkRuntime is the KBean container for a given project. Each KBean instance belongs to a JkRuntime. From JkRuntime, you can access other KBeans from the same or other projects.