Install the AppMap agent for Java

Supported Java versions: JDK 8, 11

Open a terminal window in the top level folder of your project and run this command:

npx @appland/appmap install-agent

You will be guided through a series of steps for installing and configuring that agent, that will look like this:

  $ npx @appland/appmap install-agent
  npx: installed 191 in 5.415s
  ? Select a target language for agent installation. Java
  ? Select the type of Java project to install the AppMap agent to. Maven
  ✔ Installing the AppMap agent...

    ╭─────────────────────────────────────────────────────────────────────────────────────╮
    │                                                                                     │
    │                    Success! The AppMap agent has been installed.                    │
    │                                                                                     │
    │   The AppMap agent will automatically record your tests when you run ./mvnw test.   │
    │              By default, AppMap files will be output to target/appmap.              │
    │                                                                                     │
    │                             For more information, visit                             │
    │                   https://appland.com/docs/reference/appmap-java                    │
    │                                                                                     │
    ╰─────────────────────────────────────────────────────────────────────────────────────╯

After you have installed the agent proceed to Record AppMaps.

Manual installation

For installation without Node.js follow this manual installation procedure.

Supported Java versions: JDK 8, 11

1. Install the appmap agent

For Maven projects

  1. Open the pom.xml file in the IntelliJ editor
  2. Locate the <plugins> tag and add the AppMap plugin as the first plugin entry:
  <!-- the plugin element goes to build/plugins -->
  <plugin>
    <groupId>com.appland</groupId>
    <artifactId>appmap-maven-plugin</artifactId>
    <executions>
        <execution>
            <phase>process-test-classes</phase>
            <goals>
                <goal>prepare-agent</goal>
            </goals>
        </execution>
    </executions>
  </plugin>

Next: create appmap.yml


For Gradle projects

  1. Open the gradle.build file in the IntelliJ editor
  2. Add the AppMap plugin to plugins
  plugins {
    //other plugins here

    id "com.appland.appmap" version "1.1.0"
  }

Next: create appmap.yml


For other than Maven or Gradle projects

  1. Download the AppMap java agent from Maven Repository.
  2. Pass the -javaagent argument to your JVM when running tests or when recording AppMaps remotely. Include the path to the AppMap java agent jar. For example: java -javaagent:<path-to-jar>/appmap-agent-<version>.jar myapp.jar
$ java -javaagent:lib/appmap-agent-1.15.1.jar myapp.jar

Next: create appmap.yml

2. Create a file named `appmap.yml` in the top level folder of your project

Add an application name and a list of Java packages you want to record to the appmap.yml file.

  # appmap.yml
  name: my_app
  packages:
    # List the packages you'd like to record here.
    - path: org.myorg.myapp
    - path: org.myorg.otherPackage

Was this page helpful? thumb_up Yes thumb_down No
Thank you for your feedback!