Getting started Community Training Tutorials Documentation APIs, AI & Tools
type
Configure how Mule applications run and debug locally in Anypoint Code Builder by editing the launch.json file in your project’s .vscode folder.
Use launch.json configurations to:
Pass runtime arguments (encryption keys, environment variables, JVM properties)
Change the debug port to avoid conflicts when running multiple applications
Create multiple run profiles for different environments (Development, QA, Production)
Run multiple Mule applications concurrently in the same workspace
Test the same application with different property values without editing code
This table lists some common properties for launch configurations.
| Property | Required | Description |
|---|---|---|
|
Yes |
Specifies the debugger type. Must be |
|
Yes |
Specifies the launch type. Must be |
|
Yes |
Display name for this configuration. Appears in the Run and Debug view dropdown menu. Use descriptive names like |
|
No |
Path to a single Mule project. Use |
|
No |
Array of project paths for running multiple Mule applications concurrently. Example: |
|
No |
Path to the Mule runtime home directory. Use |
|
No |
Command-line arguments passed to the Mule runtime JVM. Use the |
|
No |
Port number for the Mule debugger. Default: |
|
No |
Set to |
Either mule.project or mule.projects must be specified, but not both.
Create multiple launch configurations to test different environments without modifying your application code. Each configuration can have different runtime arguments, debug ports, and environment settings.
This example shows three configurations for Local Development, QA, and a Mocked environment:
{
"version": "0.2.0",
"configurations": [
{
"type": "mule-xml-debugger",
"request": "launch",
"name": "Debug - Local Dev",
"mule.project": "${workspaceFolder}",
"mule.home": "${config:mule.homeDirectory}",
"mule.runtime.args": "${config:mule.runtime.defaultArguments} -M-Denv=dev -M-Dencryption.key=devKey123",
"mule.debug.port": 6666
},
{
"type": "mule-xml-debugger",
"request": "launch",
"name": "Debug - QA Environment",
"mule.project": "${workspaceFolder}",
"mule.home": "${config:mule.homeDirectory}",
"mule.runtime.args": "${config:mule.runtime.defaultArguments} -M-Denv=qa -M-Dencryption.key=qaKey456",
"mule.debug.port": 6667
},
{
"type": "mule-xml-debugger",
"request": "launch",
"name": "Run - Mocked Services",
"mule.project": "${workspaceFolder}",
"mule.home": "${config:mule.homeDirectory}",
"mule.runtime.args": "${config:mule.runtime.defaultArguments} -M-Denv=mock -M-Dmock.services=true",
"mule.debug.port": 6666,
"noDebug": true
}
]
}
To switch between run configurations:
Open the Run and Debug view from the activity bar (
).
Click the configuration dropdown in the debug panel.
Select the configuration to use.
(for example, Debug - QA Environment).
Click Start (
) or press F5 to launch.
The selected configuration remains active until you select a different one.
The default debug port for Anypoint Code Builder is 6666. Change this port when:
Running multiple Mule applications concurrently in the same workspace
The default port conflicts with another service on your system
Testing port-specific debugging scenarios
Add or modify the mule.debug.port property in your launch configuration:
{
"configurations": [
{
"type": "mule-xml-debugger",
"request": "launch",
"name": "Debug on Port 6667",
"mule.project": "${workspaceFolder}",
"mule.home": "${config:mule.homeDirectory}",
"mule.runtime.args": "${config:mule.runtime.defaultArguments}",
"mule.debug.port": 6667
}
]
}
Each concurrent application must use a unique debug port. For example, if running three applications simultaneously, configure them with ports 6666, 6667, and 6668.
These are some configuration examples for common scenarios.
{
"configurations": [
{
"type": "mule-xml-debugger",
"request": "launch",
"name": "Debug with Encryption Key",
"mule.project": "${workspaceFolder}",
"mule.home": "${config:mule.homeDirectory}",
"mule.runtime.args": "${config:mule.runtime.defaultArguments} -M-Dencryption.key=mySecretKey"
}
]
}
For more information, see Defining and Securing Properties for a Mule Application.
{
"configurations": [
{
"type": "mule-xml-debugger",
"request": "launch",
"name": "Development Environment",
"mule.project": "${workspaceFolder}",
"mule.home": "${config:mule.homeDirectory}",
"mule.runtime.args": "${config:mule.runtime.defaultArguments} -M-Denv=dev"
},
{
"type": "mule-xml-debugger",
"request": "launch",
"name": "Production Environment",
"mule.project": "${workspaceFolder}",
"mule.home": "${config:mule.homeDirectory}",
"mule.runtime.args": "${config:mule.runtime.defaultArguments} -M-Denv=prod"
}
]
}
This configuration works with property files named dev.secure.yaml and prod.secure.yaml that use the $site variable in your Mule configuration XML.
{
"configurations": [
{
"type": "mule-xml-debugger",
"request": "launch",
"name": "Run Multiple Apps",
"noDebug": true,
"mule.projects": [
"${workspaceFolder:salesforce-integration}",
"${workspaceFolder:database-service}",
"${workspaceFolder:api-gateway}"
],
"mule.runtime.args": "${config:mule.runtime.defaultArguments}"
}
]
}
For more information, see Running Multiple Mule Applications Concurrently.
Reference OS environment variables using the ${env:VARIABLE_NAME} syntax:
{
"configurations": [
{
"type": "mule-xml-debugger",
"request": "launch",
"name": "Debug with Env Variables",
"mule.project": "${workspaceFolder}",
"mule.home": "${config:mule.homeDirectory}",
"mule.runtime.args": "${config:mule.runtime.defaultArguments} -M-Dencryption.key=${env:MULE_ENCRYPTION_KEY} -M-Denv=${env:MULE_ENV}"
}
]
}
To create or open the launch.json file:
Open the Command Palette.
Use the keyboard shortcuts:
Mac: Cmd+Shift+p
Windows: Ctrl+Shift+p
Select View > Command Palette.
Enter and select Open 'launch.json'.
If the file doesn’t exist, Anypoint Code Builder creates it in the .vscode folder of your project.
Edit the configuration properties as needed.
Save the file.
The new or updated configuration appears in the Run and Debug view dropdown.