When you build changes of your code, this modules restarts your app automatically, in the same JVM, leading to much faster restarts, as it doesn't need to recompile most of the code.
Warning
If you are using Spring, use spring-boot-devtools instead.
<dependencies>
<dependency>
<groupId>io.github.freya022</groupId>
<artifactId>BotCommands-restarter</artifactId>
<version>VERSION</version>
</dependency>
</dependencies>repositories {
mavenCentral()
}
dependencies {
implementation("io.github.freya022:BotCommands-restarter:VERSION")
}To use the latest, unreleased changes, see SNAPSHOTS.md.
You can enable the feature by doing so, after which, every build will restart your application.
Note
You should minimize the amount of code executed before calling BotCommandsRestarter.initialize,
as it will run twice on startup, then everytime it is restarted.
Important
You must only use this feature during development, here are a few ways to do so:
- Using a program argument like
--devthen reading it fromargs - Using a configuration file with a
IS_DEVproperty - Using an environment variable
fun main(args: Array<out String>) {
// You should enable this only during development
@OptIn(ExperimentalRestartApi::class)
BotCommandsRestarter.initialize(args) {
// Optional configuration
}
// ...
BotCommands.create {
// ...
}
}void main(String[] args) {
// You should enable this only during development
BotCommandsRestarter.initialize(args, builder -> {
// Optional configuration
});
// ...
BotCommands.create(config -> {
// ...
});
}