Installation
๐ Quick Start
Installation
Add TimesAPI to your project:
Maven
<repositories>
<repository>
<id>mongenscave-releases</id>
<url>https://repo.mongenscave.com/releases</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.mongenscave</groupId>
<artifactId>mc-TimesAPI</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
Gradle
repositories {
maven {
url "https://repo.mongenscave.com/releases"
}
}
dependencies {
implementation 'com.mongenscave:mc-TimesAPI:1.0.0'
}
โ ๏ธ Important: Shadow JAR Required TimesAPI requires proper shadowing to include all dependencies. Make sure to use the Shadow plugin in your build.
Gradle Shadow Plugin
plugins {
id 'com.github.johnrengelman.shadow' version '8.1.1'
}
shadowJar {
archiveClassifier.set('')
mergeServiceFiles()
}
Maven Shade Plugin
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.4.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
๐งช Basic Usage
import com.mongenscave.timesapi.TimesAPI;
public class MyApplication {
public static void main(String[] args) {
// Create TimesAPI instance
TimesAPI scheduler = new TimesAPI();
// Schedule a daily task
scheduler.schedule("EVERYDAY @ 18:00", () -> {
System.out.println("Daily backup started!");
});
// Schedule a weekly task
scheduler.schedule("EVERY MON,WED,FRI @ 09:30", () -> {
System.out.println("Weekly report generation");
});
// Don't forget to shutdown when your app closes
Runtime.getRuntime().addShutdownHook(new Thread(scheduler::shutdown));
}
}
Learn more @ Github Repository
Last updated