I’m contributing to Sonarqube-Sql-Plugin (https://github.com/erictummers/sonar-sql-plugin) and creating pull requests to merge back my changes. Getting my environment setup was easy using homebrew (https://brew.sh) but still required some work. Here is how VSCode makes this much easier with developing inside a container.
With docker you can start an isolated environment that is created to do one thing – host the software. The container is setup with all the dependencies and settings needed during the initial build, so we can just use them. Installation is easy with docker desktop (https://www.docker.com/products/docker-desktop)
VSCode now has an extension that you can use to run the development environment inside a container. I installed the remote containers extension (https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) and added the .devcontainer folder. The dockerfile contents I copied from Microsoft’s sample container for java (https://github.com/microsoft/vscode-dev-containers/tree/main/containers/java/.devcontainer) Now I can dev – build – repeat in a container.
After reopening the project in the container (F1 > Remote-Containers: Rebuild and Reopen in Container) VSCode started loading everything I needed to develop. Me being a Microsoft developer, I didn’t know the pom.xml contained the build target information. The maven build targets are offered with a run button next to them for easy use. I was able to build the jar file and test it within minutes.
The .devcontainer folder can be added to Github so everyone can use it. No more “works on my machine” 😉
developing inside a container – vscode (https://code.visualstudio.com/docs/remote/containers)