# Java Maven Helper

> Maven build system, dependency management, and Java project configuration assistance.

- **Type:** Skill
- **Install:** `agentstack add skill-curiouslearner-devkit-java-maven-helper`
- **Verified:** Pending review
- **Seller:** [CuriousLearner](https://agentstack.voostack.com/s/curiouslearner)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [CuriousLearner](https://github.com/CuriousLearner)
- **Source:** https://github.com/CuriousLearner/devkit/tree/main/skills/java-maven-helper

## Install

```sh
agentstack add skill-curiouslearner-devkit-java-maven-helper
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Java Maven Dependency and Build Helper Skill

Maven build system, dependency management, and Java project configuration assistance.

## Instructions

You are a Maven and Java ecosystem expert. When invoked:

1. **Maven Project Management**:
   - Initialize and configure Maven projects
   - Manage pom.xml configuration
   - Handle project structure and organization
   - Configure multi-module projects
   - Use Maven archetypes

2. **Dependency Management**:
   - Add, update, and remove dependencies
   - Manage dependency scopes
   - Handle version conflicts
   - Use dependency management sections
   - Work with BOMs (Bill of Materials)

3. **Build Configuration**:
   - Configure plugins and goals
   - Set up build profiles
   - Manage build lifecycle
   - Configure properties and resources
   - Handle filtering and resource processing

4. **Troubleshooting**:
   - Fix dependency resolution errors
   - Debug build failures
   - Resolve plugin conflicts
   - Clean corrupted repositories
   - Handle version conflicts

5. **Best Practices**: Provide guidance on Maven project organization, dependency management, and build optimization

## Maven Basics

### Project Initialization
```bash
# Create from archetype (interactive)
mvn archetype:generate

# Create quickstart project (non-interactive)
mvn archetype:generate \
  -DgroupId=com.example \
  -DartifactId=my-app \
  -DarchetypeArtifactId=maven-archetype-quickstart \
  -DarchetypeVersion=1.4 \
  -DinteractiveMode=false

# Create web application
mvn archetype:generate \
  -DgroupId=com.example \
  -DartifactId=my-webapp \
  -DarchetypeArtifactId=maven-archetype-webapp \
  -DinteractiveMode=false

# Create Spring Boot application
mvn archetype:generate \
  -DgroupId=com.example \
  -DartifactId=my-spring-app \
  -DarchetypeArtifactId=maven-archetype-quickstart \
  -DinteractiveMode=false
```

### Basic Commands
```bash
# Clean build artifacts
mvn clean

# Compile project
mvn compile

# Run tests
mvn test

# Package (create JAR/WAR)
mvn package

# Install to local repository
mvn install

# Deploy to remote repository
mvn deploy

# Skip tests
mvn package -DskipTests

# Run specific test
mvn test -Dtest=MyTest

# Show dependency tree
mvn dependency:tree

# Show effective POM
mvn help:effective-pom

# Run project (with exec plugin)
mvn exec:java -Dexec.mainClass="com.example.Main"
```

## Usage Examples

```
@java-maven-helper
@java-maven-helper --init-project
@java-maven-helper --add-dependency
@java-maven-helper --fix-dependencies
@java-maven-helper --multi-module
@java-maven-helper --troubleshoot
```

## pom.xml Configuration

### Complete Example
```xml

    4.0.0

    
    com.example
    my-application
    1.0.0-SNAPSHOT
    jar

    
    My Application
    A sample Maven project
    https://github.com/user/my-application
    2024

    
    
        Example Corp
        https://example.com
    

    
    
        
            Apache License, Version 2.0
            https://www.apache.org/licenses/LICENSE-2.0
            repo
        
    

    
    
        
            dev1
            Developer Name
            dev@example.com
            Example Corp
            
                developer
            
        
    

    
    
        scm:git:git://github.com/user/my-application.git
        scm:git:ssh://github.com/user/my-application.git
        https://github.com/user/my-application
        HEAD
    

    
    
        
        17
        17
        UTF-8

        
        3.2.0
        5.10.1
        1.18.30
        2.0.9

        
        3.11.0
        3.2.2
    

    
    
        
            
            
                org.springframework.boot
                spring-boot-dependencies
                ${spring.boot.version}
                pom
                import
            
        
    

    
    
        
        
            org.springframework.boot
            spring-boot-starter-web
        

        
        
            org.projectlombok
            lombok
            ${lombok.version}
            provided
        

        
        
            org.slf4j
            slf4j-api
            ${slf4j.version}
        

        
        
            org.junit.jupiter
            junit-jupiter
            ${junit.version}
            test
        

        
            org.springframework.boot
            spring-boot-starter-test
            test
        
    

    
    
        
        ${project.artifactId}

        
        
            
                src/main/resources
                true
            
        

        
        
            
            
                org.apache.maven.plugins
                maven-compiler-plugin
                ${maven.compiler.plugin.version}
                
                    ${maven.compiler.source}
                    ${maven.compiler.target}
                
            

            
            
                org.apache.maven.plugins
                maven-surefire-plugin
                ${maven.surefire.plugin.version}
            

            
            
                org.springframework.boot
                spring-boot-maven-plugin
                ${spring.boot.version}
                
                    
                        
                            repackage
                        
                    
                
            
        
    

    
    
        
            development
            
                true
            
            
                dev
            
        

        
            production
            
                prod
            
        
    

    
    
        
            central
            Maven Central
            https://repo.maven.apache.org/maven2
        
    

```

### Dependency Scopes
```xml

    
    
        org.apache.commons
        commons-lang3
        3.14.0
        compile
    

    
    
        javax.servlet
        javax.servlet-api
        4.0.1
        provided
    

    
    
        mysql
        mysql-connector-java
        8.0.33
        runtime
    

    
    
        org.junit.jupiter
        junit-jupiter
        5.10.1
        test
    

    
    
        com.example
        custom-lib
        1.0
        system
        ${project.basedir}/lib/custom-lib.jar
    

    
    
        org.springframework.boot
        spring-boot-dependencies
        3.2.0
        pom
        import
    

```

## Project Structure

### Standard Maven Layout
```
my-app/
├── pom.xml
├── src/
│   ├── main/
│   │   ├── java/
│   │   │   └── com/
│   │   │       └── example/
│   │   │           ├── Main.java
│   │   │           ├── model/
│   │   │           ├── service/
│   │   │           └── repository/
│   │   ├── resources/
│   │   │   ├── application.properties
│   │   │   ├── logback.xml
│   │   │   └── db/
│   │   │       └── migration/
│   │   └── webapp/  (for web apps)
│   │       ├── WEB-INF/
│   │       │   └── web.xml
│   │       └── index.html
│   └── test/
│       ├── java/
│       │   └── com/
│       │       └── example/
│       │           └── MainTest.java
│       └── resources/
│           └── test.properties
├── target/  (generated, git-ignored)
└── .gitignore
```

### Multi-Module Project
```
parent-project/
├── pom.xml (parent)
├── module-core/
│   ├── pom.xml
│   └── src/
├── module-api/
│   ├── pom.xml
│   └── src/
├── module-web/
│   ├── pom.xml
│   └── src/
└── module-cli/
    ├── pom.xml
    └── src/
```

```xml

    4.0.0

    com.example
    parent-project
    1.0.0-SNAPSHOT
    pom

    
        module-core
        module-api
        module-web
        module-cli
    

    
        17
        17
        UTF-8
    

    
        
            
            
                org.springframework.boot
                spring-boot-dependencies
                3.2.0
                pom
                import
            
        
    

```

```xml

    4.0.0

    
        com.example
        parent-project
        1.0.0-SNAPSHOT
    

    module-core

    
        
        
            org.springframework.boot
            spring-boot-starter
        
    

```

## Dependency Management

### Adding Dependencies
```bash
# Manually add to pom.xml
# Or search on https://mvnrepository.com

# Dependency format:
# ::
```

```xml

    com.google.guava
    guava
    32.1.3-jre

```

### Dependency Analysis
```bash
# Show dependency tree
mvn dependency:tree

# Show dependency tree for specific artifact
mvn dependency:tree -Dincludes=com.google.guava:guava

# Analyze dependencies
mvn dependency:analyze

# List dependencies
mvn dependency:list

# Show updates available
mvn versions:display-dependency-updates

# Show plugin updates
mvn versions:display-plugin-updates

# Purge local repository
mvn dependency:purge-local-repository
```

### Version Management
```xml

    5.3.31
    5.10.1

    
        org.springframework
        spring-core
        ${spring.version}
    

    
        
            org.springframework.boot
            spring-boot-dependencies
            3.2.0
            pom
            import
        
    

    
        org.springframework.boot
        spring-boot-starter-web
        
    

```

### Excluding Transitive Dependencies
```xml

    com.example
    some-library
    1.0.0
    
        
            commons-logging
            commons-logging
        
    

```

## Plugin Configuration

### Common Plugins

#### Compiler Plugin
```xml

    org.apache.maven.plugins
    maven-compiler-plugin
    3.11.0
    
        17
        17
        UTF-8
        
            -parameters
            -Xlint:unchecked
        
    

```

#### Surefire Plugin (Unit Tests)
```xml

    org.apache.maven.plugins
    maven-surefire-plugin
    3.2.2
    
        
            **/*Test.java
            **/*Tests.java
        
        -Xmx1024m
    

```

#### Failsafe Plugin (Integration Tests)
```xml

    org.apache.maven.plugins
    maven-failsafe-plugin
    3.2.2
    
        
            
                integration-test
                verify
            
        
    

```

#### JAR Plugin
```xml

    org.apache.maven.plugins
    maven-jar-plugin
    3.3.0
    
        
            
                true
                com.example.Main
            
        
    

```

#### Assembly Plugin (Fat JAR)
```xml

    org.apache.maven.plugins
    maven-assembly-plugin
    3.6.0
    
        
            jar-with-dependencies
        
        
            
                com.example.Main
            
        
    
    
        
            make-assembly
            package
            
                single
            
        
    

```

#### Shade Plugin (Uber JAR)
```xml

    org.apache.maven.plugins
    maven-shade-plugin
    3.5.1
    
        
            package
            
                shade
            
            
                
                    
                        com.example.Main
                    
                
            
        
    

```

#### Exec Plugin
```xml

    org.codehaus.mojo
    exec-maven-plugin
    3.1.1
    
        com.example.Main
    

```

```bash
# Run with exec plugin
mvn exec:java
mvn exec:java -Dexec.mainClass="com.example.Main"
mvn exec:java -Dexec.args="arg1 arg2"
```

## Build Profiles

### Profile Configuration
```xml

    
    
        dev
        
            true
        
        
            development
            jdbc:h2:mem:testdb
        
        
            
                com.h2database
                h2
                runtime
            
        
    

    
    
        prod
        
            production
            jdbc:postgresql://prod-db:5432/app
        
        
            
                org.postgresql
                postgresql
                runtime
            
        
        
            
                
                    org.apache.maven.plugins
                    maven-compiler-plugin
                    
                        false
                        true
                    
                
            
        
    

    
    
        test
        
            test
        
    

```

```bash
# Activate profile
mvn clean install -Pprod

# Activate multiple profiles
mvn clean install -Pdev,integration-tests

# List active profiles
mvn help:active-profiles

# Show profile-specific settings
mvn help:effective-pom -Pprod
```

## Common Issues & Solutions

### Issue: Dependency Not Found
```bash
# Error: Could not find artifact

# Solution 1: Check repository configuration
mvn dependency:tree

# Solution 2: Update Maven metadata
mvn -U clean install  # -U forces update

# Solution 3: Clear local repository
rm -rf ~/.m2/repository/com/example/problematic-artifact
mvn clean install

# Solution 4: Check network/proxy settings
# Add to ~/.m2/settings.xml
```

```xml

    
        
            example-proxy
            true
            http
            proxy.example.com
            8080
        
    

```

### Issue: Version Conflicts
```bash
# Show dependency conflicts
mvn dependency:tree -Dverbose

# Analyze dependency conflicts
mvn dependency:analyze-duplicate

# Solution: Use dependencyManagement
```

```xml

    
        
            com.google.guava
            guava
            32.1.3-jre
        
    

```

### Issue: Corrupted Repository
```bash
# Clean local repository
mvn dependency:purge-local-repository

# Or manually remove
rm -rf ~/.m2/repository

# Rebuild
mvn clean install
```

### Issue: Out of Memory
```bash
# Increase Maven memory
export MAVEN_OPTS="-Xmx2048m -XX:MaxPermSize=512m"

# Or set in .mavenrc
echo "MAVEN_OPTS='-Xmx2048m'" > ~/.mavenrc

# For Windows (setenv.bat)
set MAVEN_OPTS=-Xmx2048m -XX:MaxPermSize=512m
```

### Issue: Slow Builds
```bash
# Use parallel builds
mvn -T 4 clean install  # 4 threads
mvn -T 1C clean install # 1 thread per CPU core

# Skip tests
mvn clean install -DskipTests

# Offline mode (use local repository only)
mvn -o clean install

# Use incremental builds
mvn clean install -amd  # Also make dependents
```

## settings.xml Configuration

### Local Repository and Mirrors
```xml

    
    ${user.home}/.m2/repository

    
    
        
            nexus
            Nexus Repository
            https://nexus.example.com/repository/maven-public/
            *
        
    

    
    
        
            nexus-releases
            deployment
            password123
        
    

    
    
        
            nexus
            
                
                    central
                    https://nexus.example.com/repository/maven-public/
                    true
                    true
                
            
        
    

    
        nexus
    

```

## Testing Configuration

### JUnit 5
```xml

    
        org.junit.jupiter
        junit-jupiter
        5.10.1
        test
    

    
        org.mockito
        mockito-core
        5.7.0
        test
    

    
        org.assertj
        assertj-core
        3.24.2
        test
    

```

### Code Coverage (JaCoCo)
```xml

    org.jacoco
    jacoco-maven-plugin
    0.8.11
    
        
            
                prepare-agent
            
        
        
            report
            test
            
                report
            
        
        
            check
            
                check
            
            
                
                    
                        PACKAGE
                        
                            
                                LINE
                                COVEREDRATIO
                                0.80
                            
                        
                    
                
            
        
    

```

```bash
# Generate coverage report
mvn clean test jacoco:report

# View report at target/site/jacoco/index.html
```

## CI/CD Configuration

### GitHub Actions
```yaml
name: Maven Build

on: [push, pull_request]

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkou

…

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [CuriousLearner](https://github.com/CuriousLearner)
- **Source:** [CuriousLearner/devkit](https://github.com/CuriousLearner/devkit)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** yes

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: flagged — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-curiouslearner-devkit-java-maven-helper
- Seller: https://agentstack.voostack.com/s/curiouslearner
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
