The Catalyst Maven Plugin
Introduction
The catalyst plugin will be available under Maven plugins after you initialize a Basic I/O or an Advanced I/O function from the archetype. You can find the individual commands shown below under this plugin that will enable you to perform various operations on your Catalyst functions and Maven artifacts.
The serve and deploy command executions are performed after your request is authenticated. Catalyst currently provides proprietary authentication for the Maven plugin that is independent of the Catalyst CLI authentication. Your IDE will prompt you for the authentication token generation when you execute these commands, and the tokens that are created will be saved in your local system. The package and help commands do not require to be authenticated.
Package
The Catalyst package command is exclusive to the Maven plugin and is not available in the CLI. This allows you to pack your Java function directory as an executable bundle.
Pack a Function with the Catalyst Maven Plugin
You can pack a Java Basic I/O or Advanced I/O function as described below. We have executed this command through the VS Code IDE in this example.
Click the package command under Plugins > catalyst in the Maven tools.
You can track the progress of the execution in your IDE’s terminal. The function will be compiled to the JAR file format as a Maven SNAPSHOT. You can find the entire deployable bundle catalyst-archive.zip added in the target folder of your Maven’s project directory.
The target directory will contain all the compiled files, libraries, and other Maven dependencies, along with the build archive and the SNAPSHOT JAR of the main function.
catalyst-archive contains the deployable library files including the Java SDK, the compiled source files, catalyst-config.json, and pom.xml.
The function can now be served locally, or deployed to the remote project.
Serve
The serve command under the Catalyst Maven plugin is similar to the CLI command, catalyst serve. It enables you to serve and test your function through a localhost in your system, before you deploy it to the remote project. You can serve both Basic I/O and Advanced I/O functions and obtain their local endpoints to test.
Additionally, you can leverage your IDE’s debugger and attach it to the live serve session for an enhanced testing experience. Catalyst also enables you to perform a hot reload of the function you serve. This enables you to make changes in your function’s code and see the updates reflected live, without having to re-compile or re-serve the code.
-
The project ID and org ID associated with the function needs to be configured in pom.xml before you serve the function.
-
Your function will need to be bundled before it is served. You can package it from the plugin, or serve it directly, which will automatically execute the package command.
-
The Maven project’s directory must be in the standard structure with all required Maven and Catalyst dependency files for a successful serve.
Serve a Function with the Catalyst Maven Plugin
You can serve a Java Basic I/O or Advanced I/O function as described below. We have executed this command through the VS Code IDE in this example.
- Click the serve command under Plugins > catalyst in the Maven tools.
The terminal of your IDE will display the progress of the serve session.
- Catalyst will prompt you to authenticate your serve request if no valid authentication token is detected. Open the URL displayed in the terminal in a browser window.
- Click Accept in your browser window. This will authenticate your Catalyst account and provide the requested permissions to Catalyst CLI.
You can now close the window and navigate to your IDE.
- Catalyst will start a local server in the default port 3010. Access the local URL of the served function from the terminal.
The terminal will display a live log of the actions performed. Depending on your IDE, you can quit the serve session by killing the command execution.
Deploy
The deploy command under the Catalyst Maven plugin is similar to the CLI command, catalyst deploy. It enables you to deploy your function to the remote project after you finish testing it. You can deploy both Basic I/O and Advanced I/O functions and obtain their deployed URL endpoint.
-
The project ID and org ID associated with the function needs to be configured in pom.xml before you deploy the function.
-
Your function will need to be bundled before it is deployed. You can package it from the plugin, or deploy it directly, which will automatically execute the package command.
-
The Maven project’s directory must be in the standard structure with all required Maven and Catalyst dependency files for a successful deployment.
Deploy a Function with the Catalyst Maven Plugin
You can deploy a Java Basic I/O or Advanced I/O function as described below. We have executed this command through the VS Code IDE in this example.
- Click the deploy command under Plugins > catalyst in the Maven tools.
The terminal of your IDE will display the progress command execution.
- Catalyst will prompt you to authenticate your deploy request if no valid authentication token is detected. Open the URL displayed in the terminal in a browser window.
- Click Accept in your browser window. This will authenticate your Catalyst account and provide the requested permissions to Catalyst CLI.
You can now close the window and navigate to your IDE.
- The terminal will display the deployed URL of your function that you can access.
You will now be able to access the function in your project in the remote console.
Help
The Maven plugin provides a help command that displays help information of all the commands in the plugin when you execute it.
You can see the details in your IDE’s terminal.
Last Updated 2024-04-15 17:30:30 +0530 +0530
Yes
No
Send your feedback to us