DEV Community

Cover image for Installing Anypoint Code Builder (Desktop / VS Code Edition)
ThaSha
ThaSha

Posted on

Installing Anypoint Code Builder (Desktop / VS Code Edition)

N-I-04 — Installing Anypoint Code Builder Desktop and Anypoint CLI v4

Why This Matters

You need a local workstation that can open Mule projects, package them with Maven, and authenticate against Anypoint Platform before MuleSoft Vibes can help you build a first PoC.

This setup gives you VS Code with the Anypoint Code Builder extension pack, Java 17, Maven 3.9.9, Node 20.19.5, and anypoint-cli-v4@1.6.14 on Ubuntu, macOS, and Windows.

Prerequisites

You need an Anypoint Platform account with an Einstein-enabled Salesforce org.

You need a connected app with credentials available as environment variables.

Required versions:

Component Version
Node.js 20.19.5
npm package anypoint-cli-v4@1.6.14
Java 17.0.12-tem
Maven 3.9.9
Mule runtime target 4.9.x
VS Code Current stable from native package manager
ACB extension MuleSoft.mule-extension-pack

Set these environment variables before authentication:

export ANYPOINT_ORG_ID="2f6d9b28-7a11-4f9a-9d85-1b9d7f2c6a44"
# expected: no stdout
export ANYPOINT_ENV_ID="8f8a2f7e-6e2d-4c4a-8b8a-3a5d7e9014ab"
# expected: no stdout
export ANYPOINT_CONNECTED_APP_CLIENT_ID="acb-desktop-poc-client"
# expected: no stdout
export ANYPOINT_CONNECTED_APP_CLIENT_SECRET="replace-with-the-issued-secret-value"
# expected: no stdout
Enter fullscreen mode Exit fullscreen mode
[Environment]::SetEnvironmentVariable("ANYPOINT_ORG_ID", "2f6d9b28-7a11-4f9a-9d85-1b9d7f2c6a44", "User")
# expected: no stdout

# expected: no stdout

# expected: no stdout

# expected: no stdout
Enter fullscreen mode Exit fullscreen mode

The connected-app CLI authentication command for anypoint-cli-v4@1.6.14 is [needs verification].

Install Commands

Run one native block for your operating system.

Ubuntu 22.04 LTS uses apt-get, NodeSource Node 20, npm, and /usr/local/bin global npm paths.

#!/usr/bin/env bash
set -euo pipefail

sudo apt-get update
# expected: package lists read
sudo apt-get install -y curl unzip zip ca-certificates gnupg jq openjdk-17-jdk maven
# expected: 0 upgraded

curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
# expected: Repository configured successfully
sudo apt-get install -y nodejs=20.19.5-1nodesource1
# expected: nodejs is already the newest version

sudo npm install -g npm@10.8.2
# expected: changed
sudo npm install -g anypoint-cli-v4@1.6.14
# expected: added

sudo update-alternatives --set java /usr/lib/jvm/java-17-openjdk-amd64/bin/java
# expected: using /usr/lib/jvm/java-17-openjdk-amd64/bin/java
export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
# expected: no stdout
echo 'export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64' >> "$HOME/.bashrc"
# expected: no stdout

code --install-extension MuleSoft.mule-extension-pack
# expected: Extension 'mulesoft.mule-extension-pack' was successfully installed.
Enter fullscreen mode Exit fullscreen mode

macOS 14+ uses Homebrew and refuses to run on non-Darwin hosts.

#!/usr/bin/env bash
set -euo pipefail

[ "$(uname -s)" = "Darwin" ]
# expected: no stdout

if [ -x /opt/homebrew/bin/brew ]; then
  eval "$(/opt/homebrew/bin/brew shellenv)"
else
  eval "$(/usr/local/bin/brew shellenv)"
fi
# expected: no stdout

brew update
# expected: Already up-to-date.
brew install openjdk@17 maven node@20 jq
# expected: openjdk@17
brew install --cask visual-studio-code
# expected: visual-studio-code was successfully installed

sudo ln -sfn "$(brew --prefix)/opt/openjdk@17/libexec/openjdk.jdk" /Library/Java/JavaVirtualMachines/openjdk-17.jdk
# expected: no stdout
brew link --force --overwrite node@20
# expected: Linking

npm install -g npm@10.8.2
# expected: changed
npm install -g anypoint-cli-v4@1.6.14
# expected: added

echo 'export JAVA_HOME=$(/usr/libexec/java_home -v 17)' >> "$HOME/.zshrc"
# expected: no stdout
export JAVA_HOME=$(/usr/libexec/java_home -v 17)
# expected: no stdout

code --install-extension MuleSoft.mule-extension-pack
# expected: Extension 'mulesoft.mule-extension-pack' was successfully installed.
Enter fullscreen mode Exit fullscreen mode

Windows 11 native uses winget, PowerShell environment commands, and %USERPROFILE%.

$ErrorActionPreference = "Stop"
# expected: no stdout

Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force
# expected: no stdout

winget install --id EclipseAdoptium.Temurin.17.JDK --version 17.0.12.7 --silent --accept-package-agreements --accept-source-agreements
# expected: Successfully installed
winget install --id Apache.Maven --version 3.9.9 --silent --accept-package-agreements --accept-source-agreements
# expected: Successfully installed
winget install --id OpenJS.NodeJS.LTS --version 20.19.5 --silent --accept-package-agreements --accept-source-agreements
# expected: Successfully installed
winget install --id Microsoft.VisualStudioCode --silent --accept-package-agreements --accept-source-agreements
# expected: Successfully installed

$Env:Path = [Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [Environment]::GetEnvironmentVariable("Path", "User")
# expected: no stdout


# expected: no stdout
$Env:JAVA_HOME = "C:\Program Files\Eclipse Adoptium\jdk-17.0.12.7-hotspot"
# expected: no stdout

# expected: no stdout
$Env:Path = "$Env:JAVA_HOME\bin;$Env:Path"
# expected: no stdout

npm install -g npm@10.8.2
# expected: changed
npm install -g anypoint-cli-v4@1.6.14
# expected: added

code --install-extension MuleSoft.mule-extension-pack
# expected: Extension 'mulesoft.mule-extension-pack' was successfully installed.
Enter fullscreen mode Exit fullscreen mode

Environment Validation

Confirm that the shell resolves the expected binaries before you open a Mule project.

java -version 2>&1 | grep '17'
# expected: openjdk version "17
mvn -version | grep 'Apache Maven 3.9.9'
# expected: Apache Maven 3.9.9
node --version
# expected: v20.19.5
npm --version
# expected: 10.8.2
anypoint-cli-v4 --version
# expected: 1.6.14
code --list-extensions | grep -i 'mulesoft.mule-extension-pack'
# expected: mulesoft.mule-extension-pack
Enter fullscreen mode Exit fullscreen mode
java -version 2>&1 | Select-String "17"
# expected: openjdk version "17
mvn -version | Select-String "Apache Maven 3.9.9"
# expected: Apache Maven 3.9.9
node --version
# expected: v20.19.5
npm --version
# expected: 10.8.2
anypoint-cli-v4 --version
# expected: 1.6.14
code --list-extensions | Select-String "mulesoft.mule-extension-pack"
# expected: mulesoft.mule-extension-pack
Enter fullscreen mode Exit fullscreen mode

In VS Code, open the Anypoint Code Builder activity and sign in to Anypoint Platform from the extension UI.

The exact VS Code command palette command name for sign-in is [needs verification].

Dependency Manifest

Create Maven settings so Mule projects can resolve assets from Anypoint Exchange.

Linux and macOS path: ~/.m2/settings.xml.

Windows path: %USERPROFILE%\.m2\settings.xml.

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                              http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <servers>
    <server>
      <id>anypoint-exchange-v3</id>
      <username>~~~Client~~~</username>
      <password>${env.ANYPOINT_CONNECTED_APP_CLIENT_SECRET}</password>
    </server>
  </servers>

  <profiles>
    <profile>
      <id>Mule</id>
      <repositories>
        <repository>
          <id>anypoint-exchange-v3</id>
          <name>Anypoint Exchange</name>
          <url>https://maven.anypoint.mulesoft.com/api/v3/maven</url>
          <layout>default</layout>
        </repository>
      </repositories>
    </profile>
  </profiles>

  <activeProfiles>
    <activeProfile>Mule</activeProfile>
  </activeProfiles>
</settings>
Enter fullscreen mode Exit fullscreen mode

Write the file on Linux or macOS:

mkdir -p "$HOME/.m2"
# expected: no stdout
test -f "$HOME/.m2/settings.xml"
# expected: no stdout
mvn -X help:effective-settings | grep anypoint-exchange-v3
# expected: <id>anypoint-exchange-v3</id>
Enter fullscreen mode Exit fullscreen mode

Write the file on Windows:

New-Item -ItemType Directory -Force -Path "$Env:USERPROFILE\.m2" | Out-Null
# expected: no stdout
Test-Path "$Env:USERPROFILE\.m2\settings.xml"
# expected: True
mvn -X help:effective-settings | Select-String "anypoint-exchange-v3"
# expected: <id>anypoint-exchange-v3</id>
Enter fullscreen mode Exit fullscreen mode

Terminal Verification Script

Create verify.sh on Ubuntu or macOS.

cat > verify.sh <<'SCRIPT'
#!/usr/bin/env bash
set -euo pipefail

checks=0

expect_line() {
  local label="$1"
  local expected="$2"
  shift 2
  local output
  output="$("$@" 2>&1 | head -n 1)"
  if [[ "$output" != *"$expected"* ]]; then
    printf '[verify.sh] %s FAIL: expected "%s", got "%s"\n' "$label" "$expected" "$output"
    exit 1
  fi
  checks=$((checks + 1))
}

expect_line "java" "17" java -version
expect_line "maven" "Apache Maven 3.9.9" mvn -version
expect_line "node" "v20.19.5" node --version
expect_line "npm" "10.8.2" npm --version
expect_line "anypoint-cli-v4" "1.6.14" anypoint-cli-v4 --version
expect_line "vscode-extension" "mulesoft.mule-extension-pack" bash -lc "code --list-extensions | grep -i '^mulesoft.mule-extension-pack$'"
expect_line "maven-settings" "anypoint-exchange-v3" bash -lc "mvn -X help:effective-settings | grep anypoint-exchange-v3"

printf '[verify.sh] all %d prerequisites OK\n' "$checks"
SCRIPT
# expected: no stdout

chmod +x verify.sh
# expected: no stdout
./verify.sh
# expected: [verify.sh] all 7 prerequisites OK
Enter fullscreen mode Exit fullscreen mode

Create verify.ps1 on Windows.

@'
$ErrorActionPreference = "Stop"
$checks = 0

function Expect-Line($Label, $Expected, [ScriptBlock]$Command) {
  $output = & $Command 2>&1 | Select-Object -First 1
  if (-not ($output -like "*$Expected*")) {
    Write-Host "[verify.ps1] $Label FAIL: expected `"$Expected`", got `"$output`""
    exit 1
  }
  $script:checks++
}

Expect-Line "java" "17" { java -version }
Expect-Line "maven" "Apache Maven 3.9.9" { mvn -version }
Expect-Line "node" "v20.19.5" { node --version }
Expect-Line "npm" "10.8.2" { npm --version }
Expect-Line "anypoint-cli-v4" "1.6.14" { anypoint-cli-v4 --version }
Expect-Line "vscode-extension" "mulesoft.mule-extension-pack" { code --list-extensions | Select-String "mulesoft.mule-extension-pack" }
Expect-Line "maven-settings" "anypoint-exchange-v3" { mvn -X help:effective-settings | Select-String "anypoint-exchange-v3" }

Write-Host "[verify.ps1] all $checks prerequisites OK"
'@ | Set-Content -Encoding UTF8 .\verify.ps1
# expected: no stdout

.\verify.ps1
# expected: [verify.ps1] all 7 prerequisites OK
Enter fullscreen mode Exit fullscreen mode

Verification

Run the final Linux or macOS check from the same terminal that will launch VS Code.

./verify.sh
# expected: [verify.sh] all 7 prerequisites OK
Enter fullscreen mode Exit fullscreen mode

Expected final stdout line:

[verify.sh] all 7 prerequisites OK
Enter fullscreen mode Exit fullscreen mode

Visual assets and code-card screenshots will be added in a follow-up update.

Top comments (0)