Custom Maven Plugin in Mule 4

Custom Maven Plugin in Mule 4

raml-sync-checker custom Maven plugin is used to check if the RAML in mule 4 app - API implementation is in sync with the RAML published in Anypoint Exchange.

Problem Faced

Last week, I received a minor Change Requirement from the Client to add a field in the API Specs (RAML)

The requirement was critical, and so I quickly made the RAML change in code, pushed it to Github Repo, and got it merged to Dev. 

What I missed was: updating the same change in the corresponding API in exchange.

Though I pushed those changes to exchange the next day (I got another Change Request, and while publishing the RAML change to Exchange, I remembered what I missed. 

By the way, we do have a checklist to be followed for every new CR that is raised, but the change was so minor and critical, that I neglected the Checklist!

What is RAML Sync Verifier Plugin?

The custom plugin:

  • Checks if the Raml in API implementation project is in Sync with the Raml in Exchange
  • Gives you options to pass various configurations
  • Fails the build if the RAMLs are not in sync with each other (This configuration can be turned off).

Why Is It Required

The RAML published to Exchange and the Raml in your API implementation should be in SYNC for a particular environment. 

There are plenty of good reasons for that: 

  • Maintaining consistency of code
  • Version control
  • Reusing Fragments and canonicals 

Note: Adding the API ID (From API Manager) and Autodiscovery will not make the RAML in code in sync with exchange. 

I hate making the same mistake twice (At least when it comes to Tech Stuff!), so I created a very simple custom Maven plugin, which, during the build process, checks if the RAMLS are in sync.

I will be describing briefly about the Plugin code, and the complete code with example mule app can be found at GitHub Repo

Knowledge about developing Maven Custom Plugin
  • Knowledge about Mule 4 apps and Anypoint Platform
  • Anypoint Studio Installed 
  • Maven installed 
  • Eclipse installed
  • Valid AnyPoint Credentials
  • Have developed a simple Mule app with a basic API spec in design center using above credentials

About the Code

Project Structure

Project structure

The Plugin has just one Mojo. A Java mojo consists simply of a single class representing one plugin's goal.

Exchange API Used 

maven mulesoft build automation mule 4 anypoint platform plugin development mulesoft api raml 1.0 mule maven mulesoft open source

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

How to Configure and Use Secure Properties In Mule 4

Properties in Mule 4 can be encrypted to keep our sensitive data like ClientID and Client Password. Take a look at how to create and configure secure properties in Mule 4. Let’s discuss how to achieve this using MuleSoft's Secure Property.

An Open-Source Book About the Open Source World

Open source today is a word that often include a lot of things, such as open knowledge (Wikimedia projects), open hardware (Arduino, Raspberry Pi), open formats (ODT/ODS/ODP) and so on.

A Simple Guide to API Development Tools

APIs can be as simple as 1 endpoint for use by 100s of users or as complex as the AWS APIs with 1000s of endpoints and 100s of thousands of users. Building them can mean spending a couple of hours using a low-code platform or months of work using a multitude of tools. Hosting them can be as simple as using one platform that does everything we need or as complex as setting up and managing ingress control, security, caching, failover, metrics, scaling.

Hire Cross-Platform App Developers

AppClues Infotech is a top Mobile App Development Company in USA building high-quality Android, iOS, and Native apps for Startups, SMBs, & Enterprises. Contact us now!

Cross Platform Mobile App Development Company in USA

AppClues Infotech is a top Mobile App Development Company in USA building high-quality Android, iOS, and Native apps for Startups, SMBs, & Enterprises. Contact us now!