ais-springboot
Auto configuration library for springboot projects. Whenever any of the child auto-configure libraries are included on the client app's classpath then that respective library will auto configure itself via some condition either on property file or via declarative approach.
Technologies
- gradle
- springboot 3.3.3
- java 21 (21.0.5-tem)
Concept This project is a multi-module project and when we publish the library then all the sub projects will be published to gitlab with their respective version.
BOM(Bill of material)
To make dependency management easier, we will use Bill of Materials (BOM), a feature that offers easier and safer dependency management.
Why do we need to create BOM As a SDK developer, we will need to maintain multiple sub-modules using gradle for their dependency management. These applications will need upgrades from time to time to be up to date and to add new features. The task of updating/tracking dependencies' versions can easily become a nightmare because of conflicts between certain dependencies. For the average library consumer, using a single parent BOM version will make importing much easier.
Usage
Let's assume we already published autoconfigure-web with version 0.3.1 and autoconfigure-auth with version 0.0.2 to gitlab.
Client app's build.gradle
// import BOM
implementation(platform("uiowa.ais.springboot:autoconfigure:0.3.1"))
// import respective library
implementation "uiowa.springboot:autoconfigure-web"
implementation "uiowa.springboot:autoconfigure-auth"As you can see above that you will not provide any version to library. Those versions will be derived from the BOM and anytime we publish new versions of a library under the same BOM version then that updated version will automatically be available in all client application.
If we have any breaking change in our autoconfigure library then we can bump up BOM version itself. This way developers will need to explicitly update just BOM version instead of updating all the library version.
Local Development/Testing
Run the following on the parent project e.g. via terminal in ~/Projects/ais-springboot/
./gradlew build
./gradlew publishToMavenLocalThe publishToMavenLocal task will publish to your local maven repository (Typically this is ~/.m2/respository. Then in your client application include mavenLocal() as a first line under repository
repositories {
mavenLocal()
maven {
url 'https://gitlab.com/api/v4/projects/39953646/packages/maven'
}
mavenCentral()
}Now you can import BOM and dependencies as shown previously in the Usage section, but this time the dependencies will have your local changes.
Publish to gitlab from terminal
./gradlew publishToMavenLocal - This task will publish the artifacts to your local .m2 directory and automatically append .{hawkid}.test to the artifact version.
./gradlew publishAsTest - This task will automatically append .{hawkid}.test to all of your sub-project and bom version.
./gradlew publishAsProd - This task will publish artifacts with your actual version.
./gradlew publish - This task will skip publishing artifacts to gitlab. You need to use above tasks accordingly.