A Spring Boot application that checks and retrieves the latest stable release versions of Maven dependencies using Spring AI tools.
This tool allows developers to easily find the most recent stable version of Maven dependencies without having to manually search through Maven Central or other repositories. It uses the Maven Resolver (Aether) library to query repository metadata and provides results via a simple API.
- Retrieves the latest stable release version of Maven dependencies
- Supports querying from multiple Maven repositories (configurable)
- Integrates with Spring AI MCP (Machine Context Protocol) for tool usage
- Non-web application mode for CLI usage
- Supports external configuration files via Spring profiles
- Java 21 or higher
- Maven 3.8+ (for building)
To build the application, run:
./mvnw clean packageThis will create a JAR file in the target directory.
The application is configured via application.yml:
spring:
application:
name: dependency-checker
main:
web-application-type: none
banner-mode: off
ai:
mcp:
server:
name: maven-dependency-checker
version: 0.0.1
app:
config:
repositories:
- alias: central
url: https://repo.maven.apache.org/maven2
type: defaultYou can add additional repositories by extending the repositories section.
The application supports using external configuration files through Spring profiles. You can create environment-specific configuration files like:
application-local.yml- Configuration for developer workstations to perform ad-hoc testing with managed repositoriesapplication-managed.yml- Configuration for managed artifactory sources
For example, an application-local.yml might look like:
app:
config:
repositories:
- alias: managed
url: https://repo.company.com/maven2
type: default
- alias: central
url: https://repo.maven.apache.org/maven2
type: defaultYou can configure the tool to run as an MCP server using the sample configurations provided in the docs folder:
- sample-mcp.json: Basic MCP configuration example
- sample-external-config-mcp.json: Advanced example with external configuration and Spring profiles
The basic MCP configuration below shows the minimal setup needed:
{
"servers": {
"maven-dependency-checker": {
"type": "stdio",
"command": "java",
"args": [
"-Dspring.ai.mcp.server.stdio=true",
"-jar",
"/path/to/dependency-checker-1.0.0.jar"
]
}
},
"inputs": []
}For more complex setups, you can use external configuration files and Spring profiles as shown below:
{
"servers": {
"maven-dependency-checker": {
"type": "stdio",
"command": "java",
"args": [
"-Dspring.ai.mcp.server.stdio=true",
"-Dspring.profiles.active=managed",
"-Dspring.config.location=file:/path/to/external/application-managed.yml",
"-jar",
"/path/to/dependency-checker-1.0.0.jar"
]
}
},
"inputs": []
}This advanced configuration:
- Activates the "prod" Spring profile
- Specifies external configuration locations
- Sets environment variables to configure Maven repositories
Replace /path/to/dependency-checker-1.0.0.jar with the actual path to the JAR file, and adjust the configuration file paths as needed.
The service exposes the following tools:
Retrieves the latest stable release version of a Maven dependency.
Parameters:
groupId: The groupId of the Maven dependencyartifactId: The artifactId of the Maven dependency
Returns:
- The latest stable version number as a string, or "Version not found" if no version is available
Using the tool to find the latest version of Spring Boot:
get_latest_release(groupId="org.springframework.boot", artifactId="spring-boot-starter")
This will return the latest stable version of the spring-boot-starter dependency.
Checks if a specific version of a Maven dependency exists.
Parameters:
groupId: The groupId of the Maven dependencyartifactId: The artifactId of the Maven dependencyversion: The version to check
Returns:
trueif the version exists,falseotherwise
Using the tool to check if a specific version of a dependency exists:
check_maven_version_exists(groupId="org.springframework.boot", artifactId="spring-boot-starter", version="2.5.4")
This will return true if version 2.5.4 of the spring-boot-starter dependency exists, or false if it does not.
Below is a preview of how the Maven Dependency Checker can be used in a chat interface:
In this example interaction:
- A user asks to check Maven project dependencies for newer versions
- The tool uses
get_latest_releaseto retrieve the latest version of "spring-boot-starter-parent" - The result shows that while the project uses an older version, version "4.0.0-M1" is available
This shows how easy it is to plug the dependency checker into your favorite chat-based developer tools and get instant Maven updates—making your workflow smoother and keeping your projects up-to-date effortlessly!
