convez.ai
MCP Server
scagogogo

mvn-skills

scagogogo/mvn-skills

Ver no GitHub
InicialPluginScore · de 0 a 100

Comprehensive Maven toolkit supporting Skills, Go SDK, CLI, and MCP — execute builds, parse POM, manage dependencies, install Maven, automate Java workflows

Instalação

$npx convez-ai scagogogo/mvn-skills

1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.

Métricas

Estrelas
0
Forks
0
Acompanhando
3
Saúde
37%
Último commit
há 4 meses
Versão
v0.1.0
Issues abertas
0
Contribuidores
2

README

A tradução para o português deste README ainda está na fila.

mvn-skills

CI Release Go Reference Go Report Card License: MIT

Language: English | 简体中文

A comprehensive toolkit for operating Maven (mvn) — supporting multiple integration methods: Skills, Go SDK, CLI, and MCP.

Integration Methods

🎯 Skills (Claude Code Plugin)

Add mvn-skills as a Claude Code skill with one click:

claude plugin marketplace add scagogogo/mvn-skills

Or use the community CLI:

npx skills add scagogogo/mvn-skills@maven-operations

Once installed, Claude Code can directly execute Maven commands, parse POM files, manage dependencies, install Maven, and automate Java project builds.

# Add the marketplace
claude plugin marketplace add scagogogo/mvn-skills

# Then install the plugin
claude plugin install maven-skills@mvn-skills

Or manual installation:

mkdir -p ~/.claude/skills/maven-operations
git clone https://github.com/scagogogo/mvn-skills.git /tmp/mvn-skills-clone
cp -r /tmp/mvn-skills-clone/plugins/maven-skills/skills/maven-operations/* ~/.claude/skills/maven-operations/
rm -rf /tmp/mvn-skills-clone

📦 Go SDK

Use as a Go library in your applications:

go get github.com/scagogogo/mvn-skills@latest
import (
    "github.com/scagogogo/mvn-skills/pkg/command"
    "github.com/scagogogo/mvn-skills/pkg/finder"
    "github.com/scagogogo/mvn-skills/pkg/pom"
    "github.com/scagogogo/mvn-skills/pkg/settings"
    "github.com/scagogogo/mvn-skills/pkg/installer"
    "github.com/scagogogo/mvn-skills/pkg/local_repository"
)

🖥️ CLI

Use directly from the command line via releases:

# Download latest release
curl -sL https://github.com/scagogogo/mvn-skills/releases/latest/download/mvn-skills-latest.tar.gz | tar -xz

🔌 MCP

Integrate with AI assistants via the Model Context Protocol. The Go SDK can be wrapped as an MCP server to provide Maven operations to any MCP-compatible AI tool.

Features

  • 🔍 Maven Finder — Auto-detect Maven from PATH, M2_HOME, or Maven Wrapper
  • 📦 Command Builder — Fluent API with 30+ Maven CLI options
  • 📄 POM Parser — Parse and analyze pom.xml files
  • ⚙️ Settings Parser — Parse Maven settings.xml
  • 🗂️ Local Repository — Navigate and search the local Maven repository
  • 📥 Maven Installer — Download and install Maven on Linux/macOS/Windows
  • 🏗️ Context Support — Cancel and timeout Maven commands via context.Context
  • 🖥️ Cross-Platform — Full Windows, macOS, and Linux support

Quick Start

Find Maven

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")

Execute Maven Commands

Simple (standalone functions):

output, err := command.Clean("mvn")
output, err := command.Version("mvn")
output, err := command.DependencyGet("mvn", "joda-time", "joda-time", "2.10.10")

Builder pattern (recommended for complex builds):

output, err := command.NewCommandBuilder().
    WithWorkingDirectory("/path/to/project").
    WithBatchMode().
    WithSkipTests().
    CleanInstall()

Context & Cancellation

ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()

output, err := command.NewCommandBuilder().
    WithContext(ctx).
    CleanDeploy()

Parse POM Files

project, err := pom.ParseFile("pom.xml")
fmt.Printf("GAV: %s:%s:%s\n", project.GroupId, project.ArtifactId, project.Version)

Parse Maven Version

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

API Overview

Command Builder Options

OptionFlagDescription
WithBatchMode()-BNon-interactive mode (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 threads
WithFailAtEnd()-faeFail at end
WithNoTransferProgress()-ntpNo download progress
WithEnv(...)—Set environment variables
WithContext(ctx)—Cancellation/timeout support

Lifecycle Convenience Methods

builder.Clean()          // mvn clean
builder.Compile()        // mvn compile
builder.Test()           // mvn test
builder.Package()        // mvn package
builder.Verify()         // mvn verify
builder.Install()        // mvn install
builder.Deploy()         // mvn deploy
builder.Site()           // mvn site
builder.Validate()       // mvn validate

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

Structured Option Types

For commands with many parameters:

// Dependency get with options
opts := &command.DependencyGetOption{
    GroupId:    "joda-time",
    ArtifactId: "joda-time",
    Version:    "2.10.10",
    Classifier: "sources",
}
output, err := command.DependencyGetWithOptions("mvn", opts)

// Deploy file with options
deployOpts := &command.DeployDeployFileOption{
    File:         "target/my-app.jar",
    PomFile:      "pom.xml",
    RepositoryId: "internal-repo",
    URL:          "https://repo.example.com/maven2",
}
output, err := command.DeployDeployFileWithOptions("mvn", deployOpts)

// Install artifact with flexible packaging
installOpts := &command.InstallFileOption{
    File:       "my-app.war",
    GroupId:    "com.example",
    ArtifactId: "my-app",
    Version:    "1.0.0",
    Packaging:  "war",
}
output, err := command.InstallFile("mvn", installOpts)

Error Handling

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)
    }
}

Packages

PackageDescription
pkg/commandMaven command execution (builder pattern + standalone functions)
pkg/finderFind Maven executable on the system
pkg/installerDownload and install Maven
pkg/pomParse and analyze pom.xml files
pkg/settingsParse Maven settings.xml files
pkg/local_repositoryNavigate and search local Maven repository

Releases

Releases are automated via GoReleaser and published to GitHub Releases.

Use as Go Module

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

# Specific version
go get github.com/scagogogo/mvn-skills@v0.1.0

Download a Release

Each release includes source archives and SHA256 checksums for verification:

# Download latest source archive
curl -sL https://github.com/scagogogo/mvn-skills/releases/latest/download/mvn-skills-latest.tar.gz -o mvn-skills.tar.gz

# Verify checksum
curl -sL https://github.com/scagogogo/mvn-skills/releases/latest/download/checksums.txt -o checksums.txt
sha256sum -c checksums.txt --ignore-missing

Documentation

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'feat: add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License — see the LICENSE file for details.

Ver o original no GitHub

Bom para

Relacionados