AppMap is an open source IntelliJ IDEA plugin which helps you improve your code by showing you how it behaves, feature by feature, as you work. It does this by automatically generating interactive maps of architecture and code behavior right in your editor.
This 2 ¹/₂ minute video shows how to install the AppMap plugin, how to configure it to map your Java code, and how to navigate your code using the interactive diagrams.
It uses the Spring Pet Clinic as an example program.
Here are the step-by-step instructions that are demonstrated in the video, or you can follow the Quickstart for IntelliJ written instructions.
AppMap works by recording code execution paths of your app and visualizing them in interactive diagrams directly in your code editor. A good way to create AppMaps is by recording unit, functional or integration test cases. The Pet Clinic project uses JUnit tests, which will be a source of AppMaps in this demo.
00:12 Installing AppMap from the JetBrains Marketplace takes only a moment:
- Open the IntelliJ IDEA preferences
- Select Plugins, click on the Marketplace tab and search for
- Click on the
Installbutton, then click on
When the IDE restarts, the AppMap plugin is installed and ready for viewing AppMaps.
The AppMap framework uses a file called
appmap.yml to determine which code to map.
00:20 Create a new file
appmap.yml in the root folder of your project. You should add all the Java packages of your project. Here is an example for the Pet Clinic application that is used in this demo:
name: PetClinic packages: - path: org.springframework.samples.petclinic
To get a recording, run the tests with an AppMap maven plugin that sets up the JVM for AppMap recording. The popular
jacoco code coverage tool uses a similar approach in Maven projects.
00:54 Add the AppMap plugin to the
build/plugins section of the POM:
<!-- AppMap agent, default parameters --> <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>
01:10 When you run the Maven
test phase, the AppMap recording agent will record AppMaps from the tests and save them in the
$buildDir/appmap folder of the project, one AppMap per each recorded test case.
$ mvnw test
01:17 Open the AppMaps view - click on the
AppMaps tab in the UI. Or, press
CTRL or COMMAND + SHIFT + A, then type "AppMaps" in the search box and pick the `AppMaps View" from the list.
Select an AppMap from the list of all AppMaps found in the project folders, or search for an AppMap with a specific phrase in its name, for example "create owner".
Double click on an AppMap in the list, an interactive diagram viewer opens.
01:25 Discover how the Pet Clinic application works in the AppMap diagrams.
- Start with the big picture of your software design and view all code components in the Dependency Map - Web Service endpoints, Java packages/classes/functions and SQL commands and their inter-dependencies
- Navigate to sources of classes and functions directly from the diagrams so you don't have to look for them manually
- Drill down the execution details of code and SQL in the execution Trace.
01:45 Or, you can use a bottom-up approach. Let's say you want to know what code modifies data in the database.
- Start with a SQL command of interest - like an INSERT
- View how it's connected to other calls in the Trace, then backtrack to its calling component and open its source file
- See how it is connected to other code and Web Service endpoints.
This is only a small demonstration of the AppMap capabilities. For more information, step-by-step instructions and practical how-tos, check out the AppMap documentation.
Thanks to Petr and Dan for all their hard work on this video!