Skip to main content

Version: 25.04

Maven Commands

This reference provides a complete list of Maven commands for Code Library development. For step-by-step implementation examples, see the Development Guides.

Code Libraries are developed via the SDK Maven plugin commands. This is a preferred approach for developers because it can be done from an IDE or a CI/CD pipeline. Alternatively, Code Libraries can be created using the Journey Manager user interface like any other service by selecting the 'Code Library' service type, see Creating Services.

Command Quick Reference

CommandPurposeWhen to Use
tm-sdk:code-lib-scaffoldGenerate a basic Code Library classStarting a new Code Library
code-lib-typecheckType check Code Library codeBefore deployment to catch errors
code-lib-packagePackage Code Library into .zip archiveBuilding deployment artifact
code-lib-deployDeploy Code Library to Journey ManagerDeploying to JM instance
code-lib-compareCompare local and JM Code Library scriptsChecking deployment differences
installInstall .jar artifact to local Maven repositoryUsing library in other projects

Scaffold Commands

Scaffold a Basic Code Library Class

Generate a new Code Library class with default package and name:

mvn initialize tm-sdk:code-lib-scaffold

With custom package and class name:

mvn initialize tm-sdk:code-lib-scaffold \
-DlibPackageName="com.avoka.tm.library.model" \
-DlibClassName="Customer"

Parameters

  • libPackageName - Package name (must follow Java conventions)
  • libClassName - Class name

Build and Deploy Commands

Build and install library

Compiles source code, runs unit tests, and installs the .jar file into local .m2 repository:

mvn clean initialize code-lib-deploy install

What it does

  1. Runs type checking (code-lib-typecheck)
  2. Packages the .zip archive (code-lib-package)
  3. Deploys to Journey Manager (code-lib-deploy)
  4. Installs .jar to local Maven repo

Use this when - You need both the JM deployment and the .jar artifact for use in other SDK projects.

Build JAR only

Build the .jar artifact only (skips JM deployment):

mvn clean initialize code-lib-typecheck install

Use this when - You need to use a Centralized Code Library in SDK solution projects but don't need to deploy to JM yet.

Build and deploy ZIP

Build the .zip archive and deploy to JM (skips .jar creation):

mvn clean initialize code-lib-deploy

Use this when - You're deploying a Code Library to JM but don't need it as a Maven dependency.

Deploy existing archive

Deploy a pre-built Code Library archive:

mvn initialize tm-sdk:code-lib-deploy "-Dlib.zip.file=target/centralized-code-lib.zip"

Use this when - Running in CI/CD pipelines or deploying existing artifacts.

Comparison and Validation

Compare local and JM versions

Check differences between local code and deployed code on JM:

mvn initialize tm-sdk:code-lib-compare

Output includes

  • Files that differ between local and JM
  • Files only present locally
  • Files only present on JM

Solution SDK Commands

Deploy Solution with Code Libraries

Compile, test, type check, package, and deploy solution including Code Libraries:

mvn clean test initialize app-deploy

What it does

  1. Compiles and tests all code
  2. Type checks Code Libraries
  3. Packages application and Code Libraries
  4. Deploys everything to JM

Note: This deploys Solution-Specific Code Libraries. Centralized Code Libraries must be deployed separately.

Command Workflow Examples

Centralized library workflow

# 1. Create new Code Library class
mvn initialize tm-sdk:code-lib-scaffold -DlibClassName="PaymentProcessor"

# 2. Develop and test locally
mvn clean test

# 3. Deploy to JM and install to Maven repo
mvn clean initialize code-lib-deploy install

# 4. Verify deployment
mvn initialize tm-sdk:code-lib-compare

Solution library workflow

# 1. Create new Code Library in solution
mvn initialize tm-sdk:code-lib-scaffold -DlibPackageName="com.avoka.tm.library.myapp"

# 2. Develop and test
mvn clean test

# 3. Deploy solution with libraries
mvn clean test initialize app-deploy