agentsclimarketplace

Maven operations

Skill scagogogo/mvn-skills/plugins/maven-skills/skills/maven-operations

A Go SDK + cobra CLI + MCP server for Maven: locate, build, parse POM/settings, resolve local repo, and install Maven across Linux/macOS/Windows. AI-agent friendly.

Install
npx -y skills add scagogogo/mvn-skills --skill maven-operations

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Executes Maven commands, parses POM files and settings.xml, manages dependencies, installs Maven, and automates Java project builds. Use when the user asks to run Maven builds, parse pom.xml, find Maven artifacts, manage local repository, install Maven, or perform any mvn-related operation. Also use when working with Java/Maven projects that need build automation, dependency resolution, or POM analysis.

The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

6.3 KB, ~1.5k tokens by cl100k_base, as published. Nobody here has run it

Maven Operations Skill

This skill provides comprehensive Maven operations through the mvn-skills Go SDK, enabling Claude Code to execute Maven commands, parse project files, and automate Java project workflows.

When to Use

  • User asks to build, test, package, or deploy a Maven project
  • User needs to parse or analyze a pom.xml file
  • User wants to find Maven dependencies or artifacts
  • User needs to install Maven on the system
  • User asks about Maven settings or configuration
  • User wants to navigate the local Maven repository
  • User needs to run any mvn command with specific options

When NOT to Use

  • The task is purely about Gradle or other build tools (not Maven)
  • The user is asking about Java code without Maven context
  • The task only involves running a simple shell command unrelated to Maven

Installation

This skill uses the mvn-skills Go SDK. Install it first:

go get github.com/scagogogo/mvn-skills@latest

Core Capabilities

1. Find Maven

Locate the Maven executable on the system:

maven, err := finder.FindMaven()
// Or find Maven Wrapper in a project directory:
maven, err := finder.FindMavenWrapper("/path/to/project")
// Or find the best available (wrapper preferred, system Maven fallback):
maven, err := finder.FindBestMaven("/path/to/project")

2. Execute Maven Commands

Simple commands:

output, err := command.Clean("mvn")
output, err := command.Compile("mvn")
output, err := command.Test("mvn")
output, err := command.Package("mvn")
output, err := command.Install("mvn")
output, err := command.Deploy("mvn")
output, err := command.Version("mvn")

Builder pattern for complex builds:

output, err := command.NewCommandBuilder().
    WithWorkingDirectory("/path/to/project").
    WithBatchMode().
    WithSkipTests().
    WithProfiles("ci", "release").
    WithProperty("maven.test.skip", "true").
    CleanInstall()

With context for cancellation/timeout:

ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute)
defer cancel()
output, err := command.NewCommandBuilder().
    WithContext(ctx).
    CleanDeploy()

3. Parse POM Files

project, err := pom.ParseFile("pom.xml")
// Access GAV coordinates
fmt.Printf("GAV: %s:%s:%s\n", project.GroupId, project.ArtifactId, project.Version)
// Check for parent POM
if project.HasParent() { ... }
// Get dependencies
deps := project.GetDependencies()
// Get modules (multi-module project)
modules := project.GetModules()

4. Parse Maven Settings

settings, err := settings.ParseFile("~/.m2/settings.xml")
// Access mirrors, profiles, servers, localRepository
mirrors := settings.Mirrors
localRepo := settings.LocalRepository

5. Dependency Operations

// Download an artifact
output, err := command.DependencyGet("mvn", "joda-time", "joda-time", "2.10.10")

// With structured options
opts := &command.DependencyGetOption{
    GroupId:    "com.example",
    ArtifactId: "my-lib",
    Version:    "1.0.0",
    Classifier: "sources",
}
output, err := command.DependencyGetWithOptions("mvn", opts)

// Print dependency tree
output, err := command.DependencyTree("mvn")

// Analyze dependency usage
output, err := command.DependencyAnalyze("mvn")

6. Local Repository Navigation

// Find local repository directory
directory := local_repository.ParseLocalRepositoryDirectory("mvn")

// Find a JAR file
jar, err := local_repository.FindJar(directory, "com.alibaba", "fastjson", "2.0.2")

// Find JAR with classifier
jar, err := local_repository.FindJarWithClassifier(directory, "com.example", "lib", "1.0", "sources")

7. Install Maven

mavenHome, err := installer.Install()
// Platform-specific:
mavenHome, err := installer.InstallMacOS()
mavenHome, err := installer.InstallLinux()
mavenHome, err := installer.InstallWindows()

Command Builder Options Reference

MethodFlagDescription
WithBatchMode()-BNon-interactive mode (essential for CI/CD)
WithSkipTests()-DskipTestsSkip test execution
WithSkipTestsCompletely()-Dmaven.test.skip=trueSkip tests entirely
WithOffline()-oOffline mode
WithUpdateSnapshots()-UForce update SNAPSHOTs
WithProfiles(...)-PActivate profiles
WithProperty(k, v)-Dk=vSet system property
WithPomFile(path)-fSpecify POM file
WithSettingsFile(path)-sSpecify settings.xml
WithProjects(...)-plBuild specific modules
WithAlsoMake()-amAlso build dependencies
WithDebug()-XDebug output
WithQuiet()-qQuiet mode
WithThreads(n)-TParallel build threads
WithFailAtEnd()-faeFail at end
WithNoTransferProgress()-ntpNo download progress
WithEnv(...)Set environment variables
WithContext(ctx)Cancellation/timeout support

Multi-Phase Convenience Methods

builder.CleanInstall()   // mvn clean install — most common CI build
builder.CleanPackage()   // mvn clean package
builder.CleanDeploy()    // mvn clean deploy
builder.CleanVerify()    // mvn clean verify
builder.CleanTest()      // mvn clean test

Error Handling

All Maven errors return *command.MavenError with structured information:

output, err := command.Clean("mvn")
if err != nil {
    var me *command.MavenError
    if errors.As(err, &me) {
        log.Printf("Exit code: %d", me.ExitCode)
        log.Printf("Command: %s %s", me.Command, strings.Join(me.Args, " "))
        log.Printf("Stderr: %s", me.Stderr)
    }
}

Version Parsing

output, _ := command.Version("mvn")
v, err := command.ParseVersion(output)
if v.IsAtLeast(3, 8, 0) {
    fmt.Println("Maven 3.8+ features available")
}

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.