2. Using Spring Migration Analyzer

2.1 Analyzing an application

To analyze an application you run the migration-analysis script, passing it the path of the application archive that you want to be analyzed. For example:

 > migration-analysis.sh /path/to/my-app.ear

This will perform an analysis of my-app.ear, producing a migration report in the current working directory. The report will be in HTML. The report is written into a directory with the same name as the archive that we analyzed. For example if you analyzed my-app.ear, the report will be written into a directory named my-app.ear.

2.1.1 Customizing the analysis

A number of different options may be passed to migration-analysis, allowing you to customize its behaviour:

Table 2.1. Command line options

-e, --excludeA path within the input that should be excluded from the analysis. Supports Ant-style path patterns. This option can be specified mutiple times.
-o The path of the output directory to which the analysis reports will be written. If not specified, the reports are written to the current working directory.
-t Allows you to specify the the type of report to create. Defaults to html which is currently the only supported report type.

2.1.2 Analyzing multiple archives

Spring Migration Analyzer can analyze multiple archives at the same time. To analyze multiple archives you provide an input path that points to a directory containing all of the archives that you want to be analyzed.

When Spring Migration Analyzer analyzes multiple archives it produces a separate report for each archive that it analyzes. Each report is written into a directory with the same name as its corresponding archive. For example, with three applications in a directory named apps:


Running Spring Migration Analyzer with the following options:

 > migration-analysis apps -o reports

Will produce the following set of reports, each in its own directory:


2.2 Viewing an HTML report

An HTML migration analysis report can be viewed by opening its index.html file in any modern web browser.

As shown in the image above, the report is divided into three main sections. Sections one and two are used for navigation and the third section is used to show the report's content. Section one lists the different categories that the report's information falls into. Clicking on a category will show details of that category's analysis. Section two lists all of the files in the application that the report contains information for. Clicking on a file will show all of the analysis for that file.

2.2.1 The report's summary

When the report is first viewed, or by clicking on Summary in the top-left navigation section, a summary of the report is shown. Reading the summary should help you to get a feel for the effort involved in migrating the application. It provides a high-level description of the application and provides some guidance on how it can be migrated to Spring. Where applicable, the guidance provides links to the relevant sections of the Spring reference documentation to help you get started.

2.2.2 The report's details

If you're interested in more details about the information in the report, you can use the links in the summary text or on the left-hand side. For example, you may want to look at a particular class to see how extensive its use of a Java EE API is, or you may want to find out more about the application's use of programmatic transaction management.

For detailed information about everything that Spring Migration Analyzer can detect, please refer to the chapter entitled "What is detected".