jooby:run is a Maven 3+ plugin for running, debugging and reloading your application.
mvn jooby:runPrints something similar to:
>>> jooby:run[info|main]: Hotswap available on: /my-app
>>> jooby:run[info|main]: includes: [**/*.class,**/*.conf,**/*.properties,*.js, src/*.js]
>>> jooby:run[info|main]: excludes: []
INFO [2015-03-31 17:47:33,000] [dev@netty]: App server started in 401ms
GET /assets/** [*/*] [*/*] (anonymous)
GET / [*/*] [*/*] (anonymous)
listening on:
http://localhost:8080/The jooby:run tool restart the application every time a change is detected on:
- classes (*.class)
- config files (*.conf and *.properties)
Changes on templates and/or static files (*.html, *.js, *.css) wont restart the application, because they are not compiled or cached while running on application.env = dev.
It's worth to mention that dynamic reload of classes is done via JBoss Modules.
<plugin>
<groupId>org.jooby</groupId>
<artifactId>jooby-maven-plugin</artifactId>
<version>1.0.0.CR8</version>
<configuration>
<mainClass>${application.class}</mainClass>
<commands>
</commands>
<compiler>on</compiler>
<fork>false</fork>
<vmArgs></vmArgs>
<debug>true</debug>
<includes>
<include>**/*.class</include>
<include>**/*.conf</include>
<include>**/*.properties</include>
</includes>
<excludes>
</excludes>
</configuration>
</plugin>A Maven 3+ property that contains the fully qualified name of the main class. Required.
Allows running the application in a separate JVM. If false it uses the JVM started by Maven 3+, while if true it will use a new JVM. Default is: false.
This property can be set from command line using the application.fork system property:
mvn jooby:run -Dapplication.fork=true
The compiler is on by default, unless:
-
A
.classpathfile is present in the project directory. If present, means you're a Eclipse user and we turn off the compiler and let Eclipse recompiles the code on save. -
The compiler is set to
off.
On compilation success, the application is effectively reloaded.
On compilation error, the application won't reload.
Compilation success or error messages are displayed in the console (not at the browser).
Start the JVM in debug mode so you can attach a remote debugger at the 8000 port. Available when fork = true, otherwise is ignored.
This property can be one of these:
true: Turn on debug mode using: -agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=nfalse: Turn off debug mode (run normally)int: Turn on debug mode using the given number as debug port:<debug>8000</debug>string: Turn on debug viastringvalue, something like: -agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n
This property can be set from command line using the application.debug system property:
mvn jooby:run -Dapplication.debug=9999
List of commands to execute before starting the application. Useful for npm, npm, etc...
<plugin>
<groupId>org.jooby</groupId>
<artifactId>jooby-maven-plugin</artifactId>
<version>1.0.0.CR8</version>
<configuration>
<mainClass>${application.class}</mainClass>
<commands>
<command>npm install</command>
<command>grunt local</command>
</commands>
</configuration>
</plugin>All processes are stopped it on CTRL+C
Set one or more JVM args:
<plugin>
<groupId>org.jooby</groupId>
<artifactId>jooby-maven-plugin</artifactId>
<version>1.0.0.CR8</version>
<configuration>
<mainClass>${application.class}</mainClass>
<fork>true</fork>
<vmArgs>
<vmArg>-Xms512m</vmArg>
<vmArg>-Xmx1024m</vmArg>
</vmArgs>
</configuration>
</plugin>Make sure to enable the fork option too, otherwise vmArgs are ignored.
List of file patterns to listen for file changes.
In order to run jooby:run from Eclipse follows these steps (no plugin required):
- Open your pom.xml, go to dependencies section and add:
<dependency>
<groupId>org.jooby</groupId>
<artifactId>jooby-run</artifactId>
<scope>provided</scope>
</dependency>Make sure to set the scope to provided, once you add the dependency you need to (re)generate Eclipse metadata with: mvn eclipse:clean eclipse:eclipse unless you have the m2 eclipse plugin installed.
-
Create a new
Java Run Configuration -
Go to Main tab and set the Main class to:
org.jooby.run.Main
- Go to the Arguments tab and set the Program Arguments to:
${project_name} dmox.App deps=${project_classpath}
- That's all! now run your application as usual and hotswap will be available.

