Tanzu Spring Commercial

Spring Application Advisor CLI Reference

Last Updated February 28, 2025

This topic provides the list of CLI commands for Spring Application Advisor, along with supported options and examples.

advisor build-config get

Generates the project build configuration compile-time dependencies and developer tools versions to compile the Java sources of a repository.

Usage

advisor build-config get [-dh] [-b=<buildTool>] [-p=<path>]

Generates the project build configuration, including compile-time dependencies and developer tools versions to compile the Java sources of a repository.

The build-configuration file is named .advisor/build-config.json. This file is generated in the build directory of the project:

  • For Maven: /target folder
  • For Gradle: /build folder

The build-configuration file is required to generate the upgrade plan of the repository.

Supported options

Options Function
-b, --build-tool=buildTool Selects the build tool used to resolve the project dependencies options:
mvnw, mvn, gradlew, gradle
(default: mvnw when there are multiple wrappers,
and mvn when there are no wrappers)
-d, --debug Prints out debug messages
-h, --help Prints the help for the command options
-p, --path=path Selects the root directory of the source code repository (default: current directory)

Examples

Example Result
advisor build-config get Generates the upgrade plan of the repository
when the root folder is in the current directory
advisor build-config get --path=/home/user/foo Generates the upgrade plan of the repository
when the root folder is in the /home/user/foo directory

advisor build-config publish

Publishes an existing build configuration of the source code repository into the Application Advisor server.

Usage

advisor build-config publish [-h] [-p=<path>] -u=<appAdvisorServerUrl>

Supported options

Options Function
-h, --help Prints the help for the command options
-p, --path=path Selects the root directory of the source code repository
(default: current directory)
-u, --url=appAdvisorServerUrl Selects the URL location of the Application Advisor server
(default: $ADVISOR_SERVER)

Examples

Example Result
advisor build-config publish --url=http://localhost:9003 Publishes the build configuration associated with the repository located in the current directory

advisor upgrade-plan get

Prints out the upgrade plan of the source code repository. An upgrade plan is the list of incremental Spring related upgrades that can be performed in isolation.

Usage

advisor upgrade-plan get [-dfh] [-p=<path>] -u=<appAdvisorServerUrl>

Supported options

Options Function
-d, --debug Prints out debug messages
-h, --help Prints the help for the command options
-f, --force Forces the resolution of the upgrade plan excluding intermediate dependencies that belong to unknown projects that use Spring.
-p, --path=path Selects the root directory of the source code repository (default: current directory)
-u, --url=appAdvisorServerUrl Selects the URL location of the Application Advisor server (default: $ADVISOR_SERVER)

Examples

Example Result
advisor upgrade-plan get --url=http://localhost:9003 Prints the upgrade plan associated to the repository located in the current directory.
advisor upgrade-plan get --force --url=http://localhost:9003 If there are unrecognized dependencies that use Spring, the upgrade plan is empty. The --force option resolves the upgrade plan by ignoring the unrecognized dependencies.

advisor upgrade-plan apply

Incrementally applies an upgrade plan to the source code repository. This command applies the first step of the upgrade plan to the source code repository. You must first generate the build configuration using advisor build-config get.

If you want to preview a list of the next versions to upgrade your dependencies to, use advisor upgrade-plan get.

Usage

advisor upgrade-plan apply [-dfh] [--from-yml] [--push]
                           [--after-upgrade-cmd=<afterUpgradeRunCommand>] [-b=<buildTool>]
                           [--build-tool-jvm-args=<buildToolJvmArgs>] [-p=<path>]
                           -u=<appAdvisorServerUrl>

Supported options

Options Function
--after-upgrade-cmd=afterUpgradeRunCommand Executes a Maven or Gradle task after applying the upgrade plan
-b, --build-tool=buildTool Selects the build tool used to compile the sources options:
mvnw, mvn, gradlew, gradle
(default: mvnw when there are multiple wrappers,
and mvn when there are no wrappers)
--build-tool-jvm-args=buildToolJvmArgs Adds JVM arguments to pass into the build tool
(default: $BUILD_TOOL_JVM_ARGS)
-d, --debug Prints out debug messages
-f, --force Forces execution of full upgrade plan, including intermediate dependencies
--from-yml Enables the upgrade plan based on the contents of the .spring-app-advisor.yml file in the selected path.
-h, --help Prints the help for the command options.
-p, --path=path Selects the root directory of the source code repository
(default: current directory)
--push Generates a pull request with the code upgrades. The environment variable GIT_TOKEN_FOR_PRS is mandatory. It should contain the value of a token with permissions for creating pull requests in the repository
--push Generates a pull request with the code upgrades. The environment variable GIT_TOKEN_FOR_PRS is mandatory. It should contain the value of a token with permissions for creating pull requests in the repository
-u, --url=appAdvisorServerUrl Selects the URL location of the Application Advisor
server (default: $ADVISOR_SERVER)

Examples

Example Result
advisor upgrade-plan apply Upgrades the repository in the current directory
advisor upgrade-plan apply --push Upgrades the repository and creates a pull request
with the changes
advisor upgrade-plan apply --push --from-yml Upgrades the repository and creates a pull request
with the changes if developers have explicitly enabled
automatic updates
advisor upgrade-plan apply --force Upgrades the repository in the current directory, ignoring version upgrades in intermediate dependencies that use Spring. This can potentially break the build, but allows you to preview the Spring-related changes.

advisor mapping build (Experimental)

Generates an upgrade mapping file for a project given its repository.

Usage

advisor mapping build [-dho] [-b=<buildTool>] [--build-tool-options=<buildToolOptions>] [-c=<coordinate>]
                      -r=<repositoryUrl> [-s=<slug>] [-t=<accessToken>] -u=<appAdvisorServerUrl>

Supported options

Options Function
-b, --build-tool=buildTool Selects the build tool used to compile the sources options:
mvnw, mvn, gradlew, gradle
(default: mvnw when there are multiple wrappers,
and mvn when there are no wrappers)
--build-tool-options=buildToolOptions Build arguments to pass to the build tool
-c, --coordinate=coordinate Main coordinate of the project to check available versions in the format groupId:artifactId
-d, --debug Prints out debug messages
-f, --force Forces execution of full upgrade plan, including intermediate dependencies
-h, --help Prints the help for the command options
-o, --offline Resolves the versions offline, using the local Maven repository
-r, --repository-url=repositoryUrl Selects the Git repository URL of the project
-s, --slug=slug Name of the project to include into the mapping result
-t, --accessToken=accessToken Personal Access Token for the git repository if needed
-u, --url=appAdvisorServerUrl Selects the URL location of the Application Advisor
server (default: $ADVISOR_SERVER)

Examples

Example Result
advisor mapping build -r='https://github.com/spring-cloud/spring-cloud-cli' Generates the upgrade mappings for spring-cloud-cli

advisor

Base syntax, requires a command.

Usage

Usage: advisor [-v] [?] [COMMAND]

Supported options

COMMAND Explanation
build-config Generates or publishes build dependencies and tools
upgrade-plan Generates or applies upgrade plan(s) to upgrade the repository code base with the latest versions of Spring components
--version Prints version of Spring Application Advisor CLI