Skip to content

A Spring Boot application that checks and retrieves the latest stable release versions of Maven dependencies using Spring AI tools.

Notifications You must be signed in to change notification settings

kishore93/MavenDependencyChecker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧩 Maven Dependency Checker

A Spring Boot application that checks and retrieves the latest stable release versions of Maven dependencies using Spring AI tools.

Overview

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.

Features

  • 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

Requirements

  • Java 21 or higher
  • Maven 3.8+ (for building)

Building the Application

To build the application, run:

./mvnw clean package

This will create a JAR file in the target directory.

Configuration

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: default

You can add additional repositories by extending the repositories section.

External Configuration

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 repositories
  • application-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: default

Usage

Running as an MCP (Model Context Protocol) Server

You can configure the tool to run as an MCP server using the sample configurations provided in the docs folder:

Basic MCP Configuration

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": []
}

Advanced Configuration with External Files

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.

API

The service exposes the following tools:

🛠️ get_latest_release

Retrieves the latest stable release version of a Maven dependency.

Parameters:

  • groupId: The groupId of the Maven dependency
  • artifactId: The artifactId of the Maven dependency

Returns:

  • The latest stable version number as a string, or "Version not found" if no version is available

Example

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.

️🛠️check_maven_version_exists

Checks if a specific version of a Maven dependency exists.

Parameters:

  • groupId: The groupId of the Maven dependency
  • artifactId: The artifactId of the Maven dependency
  • version: The version to check

Returns:

  • true if the version exists, false otherwise

Example

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.

Example Usage Preview

Below is a preview of how the Maven Dependency Checker can be used in a chat interface:

Chat Example Preview

In this example interaction:

  1. A user asks to check Maven project dependencies for newer versions
  2. The tool uses get_latest_release to retrieve the latest version of "spring-boot-starter-parent"
  3. 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!

About

A Spring Boot application that checks and retrieves the latest stable release versions of Maven dependencies using Spring AI tools.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages