News and Events

News and Events

All-in-one Mule 4 API-led Code Generator

Given archetype will generate a comprehensive Mulesoft project structure with common parent project, sharing everything possible to share around Maven builds, Mule commons project containing various re-usable flows, Dataweave scripts and other Mule artifacts that can be shared across all your Mulesoft projects and typical API-led API applications for: experience, process and system layers.

Code generated by Netflexity’s Mule 4 (CloudHub) archetype offers the best Mulesoft foundation to build on top of, following best naming conventions and project architecture that took years of experience to put together. All you need to do is use it and extend if necessary to accommodate your project needs.

Prerequisites

1. Install Java 8 JDK

2. Install and configure Maven (Mac OS instructions…)

I’m not gonna go into details on how to do this but the very high level steps are:

  • Download maven
  • Explode zip into your file system (use a location with no spaces. e.g. /Applications/<exploded_archive>)
  • Create M2_HOME environment variable pointing to the new maven directory:
    • e.g. export M2_HOME=/Applications/apache-maven-3.6.0
  • Add M2_HOME/bin to the default PATH environment variable:
    • e.g. export PATH=$PATH:$M2_HOME/bin
  • Open a new terminal and test:
    • mvn --version
  • Assuming all went well so far, maven will create a hidden folder name .m2 under your user home (e.g. /Users/<USER>/.m2) that will be used to locally cache the different Maven dependencies your apps need

Setup

Now, let’s add Mulesoft Exchange repository for Netflexity to access archetype Maven dependency without building and installing it locally.

Add the following <server> under <servers> in $M2_HOME/conf/settings.xml


<server>
    <id>Exchange-Netflexity</id> 
    <username>netflexity-guest</username> 
    <password>Mulesoft1</password> 
</server>

Add the following <repository> under <repositories> at the bottom of $M2_HOME/conf/settings.xml


<repository>
    <id>Exchange-Netflexity</id>
    <name>Exchange-Netflexity Repository</name>
    <url>https://maven.anypoint.mulesoft.com/api/v1/organizations/c2360a4c-f673-4d61-ab34-1a08c25dad57/maven</url>
    <layout>default</layout>
</repository>

Generate Mule 4 Applications

Now you can utilize Netflexity’s Mulesoft CloudHub Archetype by running command below.


mvn archetype:generate -DarchetypeGroupId=c2360a4c-f673-4d61-ab34-1a08c25dad57 -DarchetypeArtifactId=mule-archetype -DarchetypeVersion=1.0.1 -DgroupId=com.[your-company-groupId] -DartifactId=[your-artifact-id] -Dversion=1.0.0[your-version]