The product I am building/architecting at work these days uses Monorepo for all our Microservices. Our Microservices are primarily built using Java 17 and Spring Boot 2.6.x. For frontend and platform code(Terraform, Helm charts, configuration files, etc) we have different Git repositories. We use Gradle 7.3 as our build tool. We also make use of shared libraries for code reuse. I know people suggest you should avoid using shared libraries in Microservices but as I discussed in an earlier post I think there are valid reasons to use shared libraries in Microservices.
I prefer Monorepo for three main reasons:
Continue reading “Notes on Gradle Microservices Monorepo setup”
- Better visibility and control.
- Atomic code refactoring across Microservices. This is common in the initial phase of development.
- Easy Code sharing between Microservices
Over the last few years I have started using Gradle as my primary build tool for JVM based projects. Before using Gradle I was an Apache Maven user. Gradle takes best from both Apache Maven and Apache Ant providing you best of both worlds. Gradle borrows flexibility from Ant and convention over configuration, dependency management and plugins from Maven. Gradle treats task as first class citizen just like Ant.
A Gradle build has three distinct phases – initialization, configuration, and execution. The initialization phase determine which all projects will take part in the build process and create a Project instance for each of the project. During configuration phase, it execute build scripts of all the project that are taking part in build process. Finally, during the execution phase all the tasks configured during the configuration phase are executed.
In this post, I will list down tips that I have learnt over last few years.
Continue reading “Gradle Tips”
In this short post, I will show you how you can integrate React applications created using
create-react-app with Gradle build tool. We will cover how to build and run the tests as part of the Gradle build.
Continue reading “Running Tests and Building React applications with Gradle Build Tool”
Today, I was trying to use a Gradle plugin that was currently not published to Bintray or any other public repository. I performed following actions to use that plugin in my project.
Step 1: Build the gradle plugin
Clone the gradle plugin to your local machine and run the following command to publish plugin to your local Maven repository.
$ ./gradlew clean build
$ ./gradlew publishToMavenLocal
Step 2: Add plugin to your project build.gradle
Once you have published your plugin to local Maven repository then you need to add the plugin to your project so that you can execute it. Add the following to your
apply plugin: 'my-demo-plugin'
build.gradle shown above we are applying our plugin
my-demo-plugin using the
apply plugin command. Then we used
buildscript method to add our plugin to classpath. Also, we used local maven repo using
mavenLocal() Gradle function.
OpenShift has supported Apache Maven as default build system for Java based projects since the first release. All the Java projects created by OpenShift are maven based. A few months ago we also added support for Apache Ant. All OpenShift gears now have Apache Ant installed on them. So, using Apache Ant to build your project is as easy as updating the OpenShift build action hook. You can refer to my blog post to learn how you can use Ant to build your OpenShift projects.
Lately I have seen lot of developers asking how they can use Gradle to build their projects. Gradle combines the power and flexibility of Ant with the dependency management and conventions of Maven into a more effective way to build. A lot of open source projects and enterprises are using Gradle as their build system. The Spring Framework is one popular example of an open source project using Gradle. In this blog post, we will learn how we can configure an OpenShift Java project to use Gradle instead of Apache Maven to build the project.
Read full blog here https://www.openshift.com/blogs/run-gradle-builds-on-openshift