Custom Plugin Jar Creation and Deployment

This page describes the steps required to create a new custom plugin, generate the jars, and subsequent deployment of the custom plugin into CDAP.

Steps

The creation and deployment of custom plugins involves three broad steps.

  1. One time setup on your local machine to write the java code.

  2. Writing the plugin code and building the jar.

  3. Deploying the plugin in CDAP.

 

One Time Setup

Clone Cloud Source repository to local machine

  • Install Google Cloud SDK on your local machine following the instructions available at:

  • Run gcloud init to initialize your session with the right user name and project.

Set user name as the appropriate. 

Set project id to the project id hosting the cloud source repository.

  • Authenticate using gcloud auth login command:

  • Follow instructions on the new web page that opens up, and choose the account that you want to authenticate.

  • When successfully authenticated, you will see a web page with below message:

You are now authenticated with the Google Cloud SDK!

  • Clone Cloud Source Repository to the local machine using the following command:

gcloud source repos clone <repository_name> --project=<project-id>

Install IDE, Maven

  • Install VS Code IDE or any other IDE of your choice:

  • Install JDK 8.

    • Download and install Java: 

  • Set JAVA_HOME.

    • Run the below command to get java home directory:

/usr/libexec/java_home -V

  • Set JAVA HOME:

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Contents/Home

Build Plugin Jar

  • In VS Code, on the Terminal pane,

    • Write plugin code in the suitable path in the cloned directory structure:

e.g., /Users/<username>/<repo_name>/<plugin-name>

  • Navigate to the directory where your plugin code is located in the repository path e.g., /Users/<username>/<repo_name>/<plugin-name>

    • Run the following command to build plugin jar:

/opt/apache-maven/bin/mvn install

This will create a new sub-directory ‘Target’ with the jar and json files for the plugin as below:

<plugin_name>-1.25-SNAPSHOT.jar

<plugin_name>-1.25-SNAPSHOT.json

Deploy Plugin in Data Fusion