Alcala Chronicle

pomproperties

đź“… October 29, 2026đź“– Verified Publication
POMProperties: The Ultimate Playbook for Maven Property Extraction

POMProperties: The Ultimate Playbook for Maven Property Extraction

Key Takeaways

  • PomProperties is a lightweight CLI tool that parses Maven pom.xml files and outputs properties in JSON, XML, or YAML.
  • It bridges the gap between Maven build metadata and downstream processes such as CI/CD, container image tagging, and infrastructure-as-code.
  • Integration is straightforward: add a single script to your pipeline, reference the generated file, and you’re done.
  • Security best practices: keep the tool version pinned, validate the output, and restrict access to the properties file.
  • Common pitfalls include missing dependencyManagement scopes and handling of profiles; the playbook covers these in detail.

What is POMProperties?

POMProperties is a command‑line utility that reads a Maven Project Object Model (POM) file and emits a flat list of properties, dependencies, plugins, and other metadata. Unlike the built‑in mvn help:evaluate goal, POMProperties provides a structured, language‑agnostic output format that can be consumed by any tooling.

Typical use cases:

  • Generate a version.json file for Docker image tagging.
  • Populate Helm chart values from Maven coordinates.
  • Automate release notes generation.
  • Validate property consistency across multiple modules.

Installation & Quick Start

Prerequisites

  • Java 8+ (JRE or JDK)
  • Unix-like shell (bash, zsh) or Windows PowerShell
  • Access to your Maven project repository

Installation Steps

  1. Download the latest pomproperties.jar from GitHub Releases.
  2. Place the JAR in a dedicated tools/ directory in your repo.
  3. Create an executable wrapper script:
# pomproperties.sh
#!/usr/bin/env bash
java -jar tools/pomproperties.jar "$@"
  • Make the script executable:
  • chmod +x pomproperties.sh
    
  • Run the tool:
  • ./pomproperties.sh --file pom.xml --output-format json --output-file pom.properties.json
    

    Advanced Configuration Options

    The tool supports a wide range of flags to tailor the output. Use --help to see the full list.

    Flag Description Example
    --file Path to the POM file (default: pom.xml) --file modules/core/pom.xml
    --output-format Choose between json, yaml, or xml --output-format yaml
    --output-file Destination file path --output-file dist/pom.properties.yaml
    --include-profiles Comma‑separated list of active Maven profiles --include-profiles dev,ci
    --exclude-dependencies Regex to filter out unwanted dependencies --exclude-dependencies org\.apache\.logging
    --validate Run schema validation on output --validate

    CI/CD Integration Playbook

    GitHub Actions

    # .github/workflows/pomproperties.yml
    name: Extract POM Properties
    on: [push, pull_request]
    
    jobs:
      extract:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v4
          - name: Set up JDK 17
            uses: actions/setup-java@v4
            with:
              distribution: temurin
              java-version: 17
          - name: Install POMProperties
            run: |
              curl -L https://github.com/yourorg/pomproperties/releases/download/v1.2.3/pomproperties.jar -o tools/pomproperties.jar
              chmod +x tools/pomproperties.jar
          - name: Extract properties
            run: |
              java -jar tools/pomproperties.jar --file pom.xml --output-format json --output-file pom.properties.json
          - name: Upload artifact
            uses: actions/upload-artifact@v4
            with:
              name: pom-properties
              path: pom.properties.json
    

    GitLab CI

    # .gitlab-ci.yml
    extract_pom:
      image: openjdk:17-jdk-slim
      script:
        - wget -q https://github.com/yourorg/pomproperties/releases/download/v1.2.3/pomproperties.jar
        - java -jar pomproperties.jar --file pom.xml --output-format yaml --output-file pom.properties.yaml
      artifacts:
        paths:
          - pom.properties.yaml
    

    Azure DevOps Pipeline

    # azure-pipelines.yml
    steps:
    - task: UseJava@1
      inputs:
        versionSpec: '17'
    - script: |
        wget -q https://github.com/yourorg/pomproperties/releases/download/v1.2.3/pomproperties.jar
        java -jar pomproperties.jar --file pom.xml --output-format json --output-file $(Build.ArtifactStagingDirectory)/pom.properties.json
      displayName: 'Extract POM Properties'
    - publish: $(Build.ArtifactStagingDirectory)/pom.properties.json
      artifact: pom-properties
    

    Best Practices Checklist

    • Pin the tool version in your CI scripts to avoid breaking changes.
    • Validate output against a JSON Schema or XML XSD before downstream consumption.
    • Restrict access to the generated properties file; treat it as a secret if it contains sensitive data.
    • Handle Maven profiles explicitly; include only the ones relevant to your environment.
    • Cache dependencies to speed up repeated extraction runs.
    • Log the extraction step in CI logs for auditability.
    • Document the schema of the output in your repo README.
    • Use --exclude-dependencies to keep the output lean.

    PomProperties vs. Other Property Extraction Methods

    Feature POMProperties mvn help:evaluate Third‑Party Maven Plugin
    Output format JSON/YAML/XML (structured) Plain text Depends on plugin (often JSON)
    Performance Fast (single pass) Slow (executes Maven lifecycle) Variable
    Ease

    © 2026 Alcala Chronicle. All rights reserved.