Assign lessons to timeslots and rooms to produce a better schedule for teachers and students.
-
Install Java and Maven, for example with Sdkman:
$ sdk install java $ sdk install maven
-
Git clone the timefold-quickstarts repo and navigate to this directory:
$ git clone https://github.com/TimefoldAI/timefold-quickstarts.git ... $ cd timefold-quickstarts/java/spring-boot-integration
-
Start the application with Maven:
$ mvn spring-boot:run
or with Gradle:
$ gradle bootRun
-
Visit http://localhost:8080 in your browser.
-
Click on the Solve button.
For high-scalability use cases, switch to Timefold Solver Enterprise Edition, our commercial offering. Contact Timefold to obtain the credentials required to access our private Enterprise Maven repository.
-
Configure the Enterprise Edition Maven repository:
- Maven
-
Create
.m2/settings.xml
in your home directory with the following content:<settings> ... <servers> <server> <!-- Replace "my_username" and "my_password" with credentials obtained from a Timefold representative. --> <id>timefold-solver-enterprise</id> <username>my_username</username> <password>my_password</password> </server> </servers> ... </settings>
See Settings Reference for more information on Maven settings.
- Gradle
-
Add the following in your
build.gradle
:repositories { mavenCentral() maven { url "https://timefold.jfrog.io/artifactory/releases/" credentials { // Replace "my_username" and "my_password" with credentials obtained from a Timefold representative. username "my_username" password "my_password" } authentication { basic(BasicAuthentication) } } }
See Settings Reference for more information on Gradle settings.
-
Start the application with Maven:
$ mvn spring-boot:run -Denterprise
or with Gradle:
$ gradle bootRun -Denterprise=true
-
Visit http://localhost:8080 in your browser.
-
Click on the Solve button.
When you’re ready to deploy the application, package the project to run as a conventional jar file.
-
Build it with Maven:
$ mvn package
or with Gradle:
$ gradle clean build
-
Run the Maven output:
$ java -jar target/spring-boot-school-timetabling-1.0-SNAPSHOT.jar
or the Gradle output:
$ java -jar build/libs/spring-boot-school-timetabling-1.0-SNAPSHOT.jar
NoteTo run it on port 8081 instead, add
-Dserver.port=8081
. -
Visit http://localhost:8080 in your browser.
-
Click on the Solve button.
Important
|
The solver runs considerably slower in a native image. |
If you want faster startup times or need to deploy to an environment without a JVM, you can build a native image.
-
Build a Docker image with Maven:
$ mvn -Pnative spring-boot:build-image
or with Gradle:
$ gradle bootBuildImage
-
Start the built Docker image using
docker run
:$ docker run --rm -p 8080:8080 docker.io/library/spring-boot-school-timetabling:1.0-SNAPSHOT
-
Visit http://localhost:8080 in your browser.
-
Click on the Solve button.
-
Build it with Maven:
$ mvn -Pnative native:compile
or with Gradle:
$ gradle nativeCompile
-
Run the Maven output:
$ ./target/spring-boot-school-timetabling
or the Gradle output:
$ ./build/native/nativeCompile/java-spring-boot
NoteTo run it on port 8081 instead, add
-Dserver.port=8081
. -
Visit http://localhost:8080 in your browser.
-
Click on the Solve button.
Visit timefold.ai.