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
| Command | Purpose | When to Use |
|---|---|---|
tm-sdk:code-lib-scaffold | Generate a basic Code Library class | Starting a new Code Library |
code-lib-typecheck | Type check Code Library code | Before deployment to catch errors |
code-lib-package | Package Code Library into .zip archive | Building deployment artifact |
code-lib-deploy | Deploy Code Library to Journey Manager | Deploying to JM instance |
code-lib-compare | Compare local and JM Code Library scripts | Checking deployment differences |
install | Install .jar artifact to local Maven repository | Using 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
- Runs type checking (
code-lib-typecheck) - Packages the
.ziparchive (code-lib-package) - Deploys to Journey Manager (
code-lib-deploy) - Installs
.jarto 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
- Compiles and tests all code
- Type checks Code Libraries
- Packages application and Code Libraries
- 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