The goal of this project is to provide a command line tool to help set up a Spring Boot with Thymeleaf project.
- Download the release from https://github.com/wimdeblauwe/ttcli/releases
- Unzip the release
- Run
./ttcli help
(macOS/Linux) orttcli.exe help
(Windows) to see the options of the tool.
The application is also available via the following package managers:
- Homebrew (Linux/macOS):
brew install wimdeblauwe/homebrew-ttcli/ttcli
- Chocolatey (Windows):
choco install ttcli
Run ttcli init
to have the tool create a new Spring Boot project with an NPM based live-reload setup.
The tool will ask the following questions:
- GroupId: the Maven
groupId
that should be used for the project. - ArtifactId: the Maven
artifactId
that should be used for the project. - Name: the project name
- Live reload setup: Select how you want to have your live reload setup
- Web dependencies: Select from various CSS and/or JavaScript libraries to be added to your project.
The tool will create a new project in a sub-directory of the current directory with the name of the artifactId
and apply the following changes:
- Generate a Spring Boot project
- Add NPM dependencies and NPM scripts needed to have a live reload setup
- Add an
index.html
andlayout.html
page as a starting point for your Thymeleaf application. - Setup Tailwind CSS when selected.
- Setup Bootstrap when selected.
- Adds webjars to the Maven dependencies.
- Adds an
application-local.properties
with Thymeleaf template caching disabled.
Note
You can choose a different base directory that the tool should use via ttcli --baseDir <otherdir>
The tool allows selecting from various options for having live reload when editing HTML, CSS and JavaScript files.
Important
Be sure to always read the instructions in the generated HELP.md to know how to work with your live reload selection.
This is the simplest option, but it is also the slowest to reload upon change. The biggest advantage is that you do not need to have npm installed.
Note
If you also select 'Tailwind CSS' with this option, then you will need npm
to make it work.
This uses npm to watch the HTML, CSS and JavaScript files and processes them. This gives a quicker live reload experience compared to using DevTools.
This option uses Vite for live reloading. It requires an additional dependency on the Spring Boot side to process the assets and manifest that Vite generates. The biggest advantages:
- It is very quick to reload the changes.
- Vite supports SASS, TypeScript, ... so you can use all that now in your Spring Boot with Thymeleaf project. If you add the Vite Vue plugin, you can even write Vue components and have live reloading of them working just fine.
Support for Tailwind CSS is a bit more involved compared to other web dependency as you can't just add a webjars dependency. For that reason, the live reload options all do various customizations when you select 'Tailwind CSS' as a web dependency.
mvn verify
Use GraalVM JDK:
sdk use java 22.3.r17-grl
Run native compilation:
mvn -Pnative native:compile
An official release is done via a manual action on Github Actions.
Note
You need to configure
a GitHub access token.
Put it in ~/.jreleaser/config.properties
with for example:
JRELEASER_GITHUB_TOKEN=<github-token-value>
Check JReleaser configuration:
mvn -Djreleaser.dry.run -Prelease jreleaser:config
Posting a release from a local environment only when binaries for the current platform are available:
mvn -Prelease jreleaser:release -Djreleaser.select.current.platform