Replace your Scripts with Gradle Tasks

I really like Maven, and I really like the declarative build style, but recently I finally came to understand why Gradle is better.

For small projects that produce a common library JAR, you can still use Maven, but real-life, complex software projects always contain a lot of support scripts for deployment, copying artifacts, and so on. For some of those tasks you can find Maven plug-ins, for most of them you can write Maven plugins, but in real life you have shell scripts to do the job.

Generating Secure Properties in Mule 4

Secure Property Placeholder is an essential standard for keeping sensitive data like User ID and Password secure (encrypted/cypher-text) in the Property file. Securing properties is one of the crucial elements in every Mule project. MuleSoft has introduced a Secure properties generator with a point and click environment that saves time and effort in specific scenarios.

This blog will explore both traditional methods — using jar — and modern methods — using secure property generator — of generating secure properties in Mule 4.

Creating Self-Contained Executable JARs

When your application goes beyond a dozen of lines of code, you should probably split the code into multiple classes. At this point, the question is how to distribute them. In Java, the classical format is the Java ARchive, better known as the JAR. But real-world applications probably depend on other JARs.

This post aims to describe ways to create self-contained executable JARs, also known as uber-JARs or fat JARs.

Import Mule Application as Project Libraries For Shared Resources

Use Case: If we want to use shared resources or common global configuration from one of Mule application into another Mule application then this article could guide us to achieve this use case.

In Mule 4, Anypoint Studio’s built-in Maven support for any Mule Projects has provided a great feature where any Mule applications can be packaged into a deployable JAR file. This package contains the application and all its dependencies. It can be used as JAR file or as a mule plugin.We can also used it as a utility application referencing through project libraries. In our use case we are going to use one Mule application as utility application into another Mule application.

Spring Boot: Reading Resources

Learn how to read files from the resources folder in a Spring Boot application.

Reading files from a Spring Boot application is possible through Java 8 NIO API. This article demonstrates how to read files from the resources folder in a Spring Boot application, which is running as a standalone application or inside the Docker container. 

You may also like: Working With Resources in Spring

Starting With Apache Maven

Apache Maven is a build or a total project management tool that scores over its predecessors such as ANT for Java builds with the following advantages:

  • Useful when multiple JAR files are required for builds
  • Resolving recursive dependencies during build time
  • Creating project structures that are standardized
  • Building, publishing, and deployment of applications
  • Supports lifecycle of an application along with plugins

I have created an alumni project that is a dynamic web archive with a Servlet that says “Hello, Alumni”. 

Top 5 Course to Learn Apache Maven for Java Developers

Apache Maven, or more commonly known as just "Maven," is an important tool for Java programmers. It allows you to build your project, manage dependencies, generate documentation, and a lot more. I can vouch for Maven's usefulness because I have come from the pre-Maven world of Software development, where you need to manage all the JAR files required by your project. It may seem easy to you that just download the JAR file, but it's not so easy in practice. For example, you added a new library in your project — say the Spring Framework, which also needs log4j, but you thought log4j is already there, so you didn't do anything, only to realize that your application is not starting anymore and throwing long and convoluted errors. This can happen because of version mismatch, like Spring needed a higher version of log4j than available in your project.

This is just a tiny example that shows how manually managing dependencies can create nightmares. Maven took away all those pain by not only automatically downloading those JAR files for you but also created a central place, known as a Maven repository, to store those JAR files for better management.

Maven is not just a dependency management tool; it's, in fact, much more than that. The biggest advantage of using Maven is the following convention, which makes software development easy.

Profiling With JVisualVM

A few days back, I faced an issue on one of the Java service-hosted servers. The server load, resource consumption, and response time of service were too high.

Everyone was under the impression that the latest deployment of the JAR caused this issue, whereas the service code and performance on the local machine looked fine.