Module io.jooby.run
Package io.jooby.run

Class JoobyRun

java.lang.Object
io.jooby.run.JoobyRun

public class JoobyRun extends Object
Allow to restart an application on file changes. This lets client to listen for file changes and trigger a restart.

This class doesn't compile source code. Instead, let a client (Maven/Gradle) to listen for changes, fire a compilation process and restart the application once compilation finished.

Since:
2.0.0
Author:
edgar
  • Field Details

  • Constructor Details

    • JoobyRun

      public JoobyRun(JoobyRunOptions options)
      Creates a new instances with the given options.
      Parameters:
      options - Run options.
  • Method Details

    • addWatchDir

      public boolean addWatchDir(Path path, BiConsumer<String,Path> callback)
      Path must be a jar or file system directory. File system directory are listen for changes on file changes this method invokes the given callback.
      Parameters:
      path - Path.
      callback - Callback to listen for file changes.
      Returns:
      True if the path was added it to the classpath.
    • addResource

      public boolean addResource(Path path)
      Add the given path to the project classpath. Path must be a jar or file system directory.
      Parameters:
      path - Path.
      Returns:
      True if the path was added it to the classpath.
    • addClasses

      public boolean addClasses(Path path)
      Add the given path to the project classpath. Path must be a jar or file system directory.
      Parameters:
      path - Path.
      Returns:
      True if the path was added it to the classpath.
    • addJar

      public boolean addJar(Path path)
      Add the given path to the project classpath. Path must be a jar or file system directory.
      Parameters:
      path - Path.
      Returns:
      True if the path was added it to the classpath.
    • start

      public void start() throws Throwable
      Start the application.
      Throws:
      Throwable - If something goes wrong.
    • restart

      public void restart(Path path)
      Restart the application.
    • shutdown

      public void shutdown()
      Stop and shutdown the application.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • sneakyThrow0

      public static <E extends Throwable> E sneakyThrow0(Throwable x) throws E
      Throws:
      E extends Throwable