Devpack for Spring - developing a Gradle application

A new snap called devpack-for-spring was made generally available along with the Ubuntu 25.04 release earlier this year. A devpack, short for developer pack, is a curated collection of tools, libraries and resources to aid the software development lifecycle in a specific context.
Typically, devpacks offer tools to aid the setting up, development, maintenance and publishing of sofware projects. The Canonical announcement introduces the concept of devpack as follows:
Devpacks are snaps with collections of tools that assist in setting up, maintaining and publishing software projects. They provide tooling such as linters and formatters to maintain source code and integrations with packaging tools such as Rockcraft to deploy applications to the containers and create a self-contained build environment for the applications. The intention of devpacks is to lower the barrier of entry for developers looking to build software according to the best practices.
Getting Started
The previous series, on the Rockcraft Maven and Gradle plugins, focused on easing the process of creating application container images. It assumed that the developer would install the needed setup - the IDE, OpenJDK/GraalVM packages, maven/gradle, rockcraft, docker etc. A devpack packages all such tools and eases the process of installing and using them. In this exercise, we start with a bare minimal Ubuntu desktop installation and use the devpack-for-spring snap to bootstrap development of a Gradle-based application, in minutes!
Step 1: Install devpack-for-spring
First, let us install thedevpack-for-spring snap, which is a classic confinement snap.
sudo snap install devpack-for-spring --classic
Step 2: Run the setup command
The devpack-for-spring snap offers a setup command, that takes you through a menu and lets you install tools to aid Java application development.
devpack-for-spring setup
At each step, use the arrow keys to move through the list of options. To select an option, use the space bar. Press the enter key to move to the next menu.

The setup command lets you select tools to be auto-installed and auto-configured. For now, it includes:
The OpenJDK / GraalVM CE packages
The container environment - docker, podman etc.
Integrated Development Environment - intellij, vscode etc.
Additional tools - git, rockcraft etc.

Step 3: Install Spring Boot libraries
This is an optional step. The devpack-for-spring snap offers Spring and Spring Boot libraries as content snaps.

To speed up compilation, you may install the libraries you are developing with. For example, I plan to use Spring Boot 3.5.6 for the starter application.
sudo devpack-for-spring snap install content-for-spring-boot-35
The relevant libraries are downloaded under /snap/content-for-spring-boot-35/current/maven-repo/ which is referenced in /root/.m2/settings.xml.
Step 4: Create a starter web application
The boot start command lets you bootstrap a starter Gradle web application. Make sure you select the Gradle option, and don’t miss adding the Spring Web dependency.

Step 5: Modify the application to include your code
You may now open the project in the installed Integrated Development Environment and add your code logic to it.
Step 6: Running the format plugin
Optionally, you may run the format plugin to appropriately format/indent your source code. The list-plugins command lists plugins like format, dependencies and rockcraft.
devpack-for-spring list-plugins
To run the format plugin, simply run this:
devpack-for-spring plugin format
Step 7: Run the Rockcraft plugins
We are working with a Gradle application. To create an application container image using the Rockcraft plugins, issue this. Note that this does not any changes to the build.gradlefile.
devpack-for-spring plugin rockcraft push-rock
If this command succeeds, you must find a container image pushed to the local docker daemon.
docker image ls
Step 8: Running the application container
Just like what we’ve been doing in the previous series, run the application using this command:
docker run --network=host hello:latest exec /usr/bin/java -jar /jars/hello-0.0.1-SNAPSHOT.jar
The application should be reachable at http://localhost:8080.
Conclusion
Very much unlike the previous series, we started with a clean slate and got a Spring Boot starter web application built and running in a container in minutes. The devpack-for-spring CLI provides a generic interface to issue commands related to different plugins like dependencies, rockcraft and format. However, I see that we also lose some fine control over these plugins. For example, building and pushing an application rock for Maven is not as easy as it is for this Gradle example. Also, issuing an additional native compile step is not possible as yet. In the next post, I will talk about issues with the Maven build and discuss some inconsistencies between the Maven and Gradle experiences offered by devpack-for-spring.
Here is a screen-cast of the entire process listed above; the format step is skipped.




