Creating a Spring Boot library as JAR

Usually, when developing a Microservice you want to expose its interfaces via REST to other Microservices or to the frontend. However, you might want to develop a library that uses the functionality of Spring Boot.

By adding a Maven repackage goal to your pom.xml, your module will be packaged as a Java module instead of a Spring Boot module. This allows you to include the JAR into other Spring Boot modules as dependency. Nevertheless, you should keep in mind that this is an unconventional solution.

Build block of maven pom