Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 18, 2025

Description

Updates existing Maven workflows to use the Maven wrapper and adds Javadoc validation to the pull request workflow. Removes two redundant Maven workflows while keeping the primary CI workflows.

Changes

  • Kept and Updated .github/workflows/maven_push.yml:

    • Now uses Maven wrapper (./mvnw) instead of mvn
    • Removed unnecessary --file pom.xml parameters
    • Continues to run Sonar scans on pushes to main
    • Updates dependency graph via maven-dependency-submission-action
  • Kept and Updated .github/workflows/maven_pull_request.yml:

    • Now uses Maven wrapper (./mvnw) instead of mvn
    • Changed build step from verify to install to ensure artifacts are available in the local Maven repository for javadoc validation
    • Removed unnecessary --file pom.xml parameters
    • Added new step to validate Javadoc for production modules
    • Runs conditional Sonar scan (skips for forks and dependabot)
  • Removed redundant workflows:

    • maven-publish.yml (deprecated manual workflow)
    • maven-publish-snapshot.yml (functionality handled by release.yml)

Notes

  • release.yml handles automated releases via GitHub release creation (unchanged)
  • codeql.yml and stale.yml remain unchanged
  • All Maven commands now use the Maven wrapper (./mvnw) for consistency
  • Javadoc validation runs for xapi-model, xapi-client, and xapi-model-spring-boot-starter modules
  • Build step uses install phase instead of verify to ensure artifacts are installed in the local repository, making them available for the javadoc validation step that uses -am (also-make) flag

Checklist:

  • Public methods are documented
  • Public methods are tested
  • New and existing tests pass when run locally
  • There are no new warnings or errors
Original prompt

Create a branch named tidy/workflows-consolidate-maven and open a pull request that consolidates the existing multiple Maven GitHub Actions workflows into a single workflow and removes the redundant workflow files.

Changes to make (details):

  1. Add new file: .github/workflows/maven-ci.yml with the following contents:

name: Maven CI

on:
push:
branches:
- main
tags:
- 'v*'
pull_request:
branches:
- main
workflow_dispatch: {}

env:
MAVEN_OPTS: -Xmx2g

jobs:
build:
name: Build and Test (matrix)
runs-on: ubuntu-latest
strategy:
matrix:
java: [8, 11, 17]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

  - name: Set up JDK ${{ matrix.java }}
    uses: actions/setup-java@v4
    with:
      distribution: temurin
      java-version: ${{ matrix.java }}
      cache: maven

  - name: Cache local Maven repo
    uses: actions/cache@v4
    with:
      path: ~/.m2/repository
      key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
      restore-keys: |
        ${{ runner.os }}-maven-

  - name: Build and run tests
    run: mvn -B -U -e -DskipTests=false verify

publish:
name: Publish (snapshots/releases)
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

  - name: Set up JDK 11
    uses: actions/setup-java@v4
    with:
      distribution: temurin
      java-version: 11
      cache: maven

  - name: Configure GPG key (for releases)
    if: startsWith(github.ref, 'refs/tags/')
    run: |
      echo "$GPG_PRIVATE_KEY" | base64 --decode > private.key
      gpg --batch --import private.key
    env:
      GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY_BASE64 }}

  - name: Deploy release to Maven Central
    if: startsWith(github.ref, 'refs/tags/')
    env:
      OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
      OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
      GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
    run: |
      mvn -B -P release -DskipTests deploy -Dgpg.passphrase="$GPG_PASSPHRASE"

  - name: Deploy snapshot to OSSRH (on main branch)
    if: github.ref == 'refs/heads/main'
    env:
      MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
      MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
    run: |
      mvn -B -DskipTests deploy -P snapshot

Notes and rationale:

  • The repo currently contains multiple Maven workflows that overlap: .github/workflows/maven_push.yml, .github/workflows/maven_pull_request.yml, .github/workflows/maven-publish.yml, .github/workflows/maven-publish-snapshot.yml. These will be removed to reduce duplication and simplify CI.
  • Keep codeql.yml and stale.yml untouched.
  • release.yml will be left as-is. If release.yml overlaps with Maven Central release steps, we can later consolidate or disable one of them; for now this PR focuses on replacing the multiple maven_* workflows with this consolidated workflow.

Files to delete:

  • .github/workflows/maven_push.yml
  • .github/workflows/maven_pull_request.yml
  • .github/workflows/maven-publish.yml
  • .github/workflows/maven-publish-snapshot.yml

Branch name: tidy/workflows-consolidate-maven
Commit message: chore(ci): consolidate maven workflows into .github/workflows/maven-ci.yml and remove duplicates

PR title: chore(ci): consolidate maven workflows into maven-ci.yml and remove duplicates
PR description: Adds a single consolidated Maven CI workflow (pull request checks, push builds, snapshot publish on main, release publish on tags) and removes four redundant Maven workflow files. Notes about required repository secrets (OSSRH_USERNAME, OSSRH_PASSWORD, GPG_PRIVATE_KEY_BASE64, GPG_PASSPHRASE) are included in the PR description so maintainers can verify secrets. Keep codeql.yml and stale.yml unchanged. release.yml is untouched in this change.

Do not set an assignee. Do not include images.

This pull request was created as a result of the following prompt from Copilot chat.

Create a branch named tidy/workflows-consolidate-maven and open a pull request that consolidates the existing multiple Maven GitHub Actions workflows into a single workflow and removes the redundant workflow files.

Changes to make (details):

  1. Add new file: .github/workflows/maven-ci.yml with the following contents:

name: Maven CI

on:
push:
branches:
- main
tags:
- 'v*'
pull_request:
branches:
- main
workflow_dispatch: {}

env:
MAVEN_OPTS: -Xmx2g

jobs:
build:
name: Build and Test (matrix)
runs-on: ubuntu-latest
strategy:
matrix:
java: [8, 11, 17]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

  - name: Set up JDK ${{ matrix.java }}
    uses: actions/setup-java@v4
    with:
      distribution: temurin
      java-version: ${{ matrix.java }}
      cache: maven

  - name: Cache local Maven repo
    uses: actions/cache@v4
    with:
      path: ~/.m2/repository
      key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
      restore-keys: |
        ${{ runner.os }}-maven-

  - name: Build and run tests
    run: mvn -B -U -e -DskipTests=false verify

publish:
name: Publish (snapshots/releases)
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

  - name: Set up JDK 11
    uses: actions/setup-java@v4
    with:
      distribution: temurin
      java-version: 11
      cache: maven

  - name: Configure GPG key (for releases)
    if: startsWith(github.ref, 'refs/tags/')
    run: |
      echo "$GPG_PRIVATE_KEY" | base64 --decode > private.key
      gpg --batch --import private.key
    env:
      GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY_BASE64 }}

  - name: Deploy release to Maven Central
    if: startsWith(github.ref, 'refs/tags/')
    env:
      OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
      OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
      GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
    run: |
      mvn -B -P release -DskipTests deploy -Dgpg.passphrase="$GPG_PASSPHRASE"

  - name: Deploy snapshot to OSSRH (on main branch)
    if: github.ref == 'refs/heads/main'
    env:
      MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
      MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
    run: |
      mvn -B -DskipTests deploy -P snapshot

Notes and rationale:

  • The repo currently contains multiple Maven workflows that overlap: .github/workflows/maven_push.yml, .github/workflows/maven_pull_request.yml, .github/workflows/maven-publish.yml, .github/workflows/maven-publish-snapshot.yml. These will be removed to reduce duplication and simplify CI.
  • Keep codeql.yml and stale.yml untouched.
  • release.yml will be left as-is. If release.yml overlaps with Maven Central release steps, we can later consolidate or disable one of them; for now this PR focuses on replacing the multiple maven_* workflows with this consolidated workflow.

Files to delete:

  • .github/workflows/maven_push.yml
  • .github/workflows/maven_pull_request.yml
  • .github/workflows/maven-publish.yml
  • .github/workflows/maven-publish-snapshot.yml

Branch name: tidy/workflows-consolidate-maven
Commit message: chore(ci): consolidate maven workflows into .github/workflows/maven-ci.yml and remove duplicates

PR title: chore(ci): consolidate maven workflows into maven-ci.yml and remove duplicates
PR description: Adds a single consolidated Maven CI workflow (pull request checks, push builds, snapshot publish on main, release publish on tags) and removes four redundant Maven workflow files. Notes about required repository secrets (OSSRH_USERNAME, OSSRH_PASSWORD, GPG_PRIVATE_KEY_BASE64, GPG_PASSPHRASE) are included in the PR description so maintainers can verify secrets. Keep codeql.yml and stale.yml unchanged. release.yml is untouched in this change.

Do not set an assignee. Do not include images.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…i.yml and remove duplicates

Co-authored-by: thomasturrell <1552612+thomasturrell@users.noreply.github.com>
Copilot AI changed the title [WIP] Consolidate multiple Maven GitHub Actions workflows chore(ci): consolidate maven workflows into maven-ci.yml and remove duplicates Nov 18, 2025
Copilot AI requested a review from thomasturrell November 18, 2025 15:40
Co-authored-by: thomasturrell <1552612+thomasturrell@users.noreply.github.com>
Copy link
Contributor

@thomasturrell thomasturrell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot make sure all workflows that we keep use the maven wrapper. check all usage of --file parameter and remove if unnecessary

Copilot AI changed the title chore(ci): consolidate maven workflows into maven-ci.yml and remove duplicates chore(ci): add maven-ci.yml workflow and remove redundant workflows Nov 18, 2025
Copilot AI requested a review from thomasturrell November 18, 2025 15:52
…pdate workflows to use maven wrapper

Co-authored-by: thomasturrell <1552612+thomasturrell@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 18, 2025

@copilot make sure all workflows that we keep use the maven wrapper. check all usage of --file parameter and remove if unnecessary

Updated all workflows to use Maven wrapper (./mvnw) and removed unnecessary --file pom.xml parameters in commit 95c84c3.

@thomasturrell thomasturrell marked this pull request as ready for review November 18, 2025 16:04
Copilot AI review requested due to automatic review settings November 18, 2025 16:05
Copilot AI changed the title chore(ci): add maven-ci.yml workflow and remove redundant workflows chore(ci): update maven workflows to use maven wrapper and add javadoc validation Nov 18, 2025
Copilot AI requested a review from thomasturrell November 18, 2025 16:05
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR modernizes the Maven CI workflows by adopting the Maven wrapper and enhancing documentation validation. The changes simplify the workflow configuration while adding quality checks.

  • Updates existing workflows to use Maven wrapper (./mvnw) for consistent builds
  • Adds Javadoc validation to the pull request workflow for production modules
  • Removes two deprecated/redundant workflow files that are no longer needed

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
.github/workflows/maven_push.yml Updated to use Maven wrapper and removed unnecessary --file pom.xml parameters
.github/workflows/maven_pull_request.yml Updated to use Maven wrapper, added Javadoc validation step for production modules, removed unnecessary parameters
.github/workflows/maven-publish.yml Removed deprecated manual release workflow (replaced by automated release.yml)
.github/workflows/maven-publish-snapshot.yml Removed redundant snapshot publishing workflow (functionality handled by release.yml)

…fy to ensure artifacts are available for javadoc

Co-authored-by: thomasturrell <1552612+thomasturrell@users.noreply.github.com>
@sonarqubecloud
Copy link

@thomasturrell thomasturrell merged commit 8279bf3 into main Nov 18, 2025
6 checks passed
@thomasturrell thomasturrell deleted the copilot/tidyconsolidate-maven-workflows branch November 18, 2025 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants