Mule SDK to Create Custom Connectors
Create your first Mule SDK project in just a few steps:
- Install required software
- Generate a project using Maven and explore it
- Set up your IDE
- Build the project you generated
- Develop a connector or module
- Run the connector or module in Anypoint Studio
The SDK provides a Maven plugin and a Maven archetype to create new projects. The archetype is a project template; use it to ensure your new project has a consistent structure, employs recommended practices, and contains a few elements for you to experiment with.
Install the Required Software
Install and verify that the following tools are working in your local environment:
- Java Development Kit 8 (JDK 8) to compile and build your Java code.
- Apache Maven, version 3.3.9 or higher, to manage your project’s build.
Generate a Project Using the Maven Plugin
Run the
generate
command to create an extension project based on the Maven archetype:mvn org.mule.extensions:mule-extensions-archetype-maven-plugin:1.2.0:generate
You are prompted to provide required field values, then a new project is generated.
The pom.xml has the following structure:
<parent>
<groupId>org.mule.extensions</groupId>
<artifactId>mule-modules-parent</artifactId>
<version>1.1.3</version>
</parent>
Once the code is modified to achieve the objective of the Connector, please install the connector in the repository
mvn install:install-file -DgroupId=com.mindtelligent.connect -DartifactId=MindTelligentPayloadProcessorForMule -Dversion=2.1.2 -Dclassifier=mule-plugin -Dpackaging=jar -Dfile=MindTelligentPayloadProcessorForMule-2.1.2-mule-plugin.jar
Replace the JAR file with the name of your JAR file.
Once your connector is working, you can try it in Anypoint Studio.
Go to your Mule app
pom.xml
file and add the connector as a <dependency>
with its groupId
, artifactId
, and version
.
Example: Dependency
...
<dependencies>
...
<dependency>
<groupId>com.mindtelligent.connect</groupId>
<artifactId>MindTelligentPayloadProcessorForMule </artifactId>
<version>2.1.2</version>
<classifier>mule-plugin</classifier>
</dependency>
...
</dependencies>
...
You are Ready to use the Connector