Files
setup-java/.github/workflows/e2e-publishing.yml
T
Bruno BorgesandCopilot App b843ebf9b9
Validate cache / sbt-restore (macos-15-intel) (push) Blocked by required conditions
Validate cache / gradle1-save (macos-latest) (push) Waiting to run
Validate cache / sbt-restore (ubuntu-22.04) (push) Blocked by required conditions
Validate cache / sbt-save (windows-latest) (push) Waiting to run
Validate cache / gradle-save (macos-15-intel) (push) Waiting to run
Validate cache / gradle-save (windows-latest) (push) Waiting to run
Validate cache / gradle-restore (macos-15-intel) (push) Blocked by required conditions
Validate cache / gradle-restore (ubuntu-latest) (push) Blocked by required conditions
Validate cache / gradle-restore (windows-latest) (push) Blocked by required conditions
Validate cache / maven-save (macos-15-intel) (push) Waiting to run
Validate cache / maven-save (windows-latest) (push) Waiting to run
Validate cache / maven-restore (macos-15-intel) (push) Blocked by required conditions
Validate cache / maven-restore (ubuntu-latest) (push) Blocked by required conditions
Validate cache / maven-restore (windows-latest) (push) Blocked by required conditions
Validate cache / sbt-save (macos-15-intel) (push) Waiting to run
Validate cache / sbt-restore (windows-latest) (push) Blocked by required conditions
Validate cache / gradle1-save (windows-latest) (push) Waiting to run
Validate cache / gradle1-restore (macos-latest) (push) Blocked by required conditions
Validate cache / gradle1-restore (ubuntu-latest) (push) Blocked by required conditions
Validate cache / gradle1-restore (windows-latest) (push) Blocked by required conditions
Validate cache / gradle2-restore (macos-latest) (push) Blocked by required conditions
Validate cache / gradle2-restore (ubuntu-latest) (push) Blocked by required conditions
Validate cache / gradle2-restore (windows-latest) (push) Blocked by required conditions
Validate cache / maven1-save (macos-15-intel) (push) Waiting to run
Validate cache / maven1-save (windows-latest) (push) Waiting to run
Validate cache / maven1-restore (macos-15-intel) (push) Blocked by required conditions
Validate cache / maven1-restore (ubuntu-latest) (push) Blocked by required conditions
Validate cache / maven1-restore (windows-latest) (push) Blocked by required conditions
Validate cache / maven2-restore (macos-15-intel) (push) Blocked by required conditions
Validate cache / maven2-restore (ubuntu-latest) (push) Blocked by required conditions
Validate cache / maven2-restore (windows-latest) (push) Blocked by required conditions
Validate cache / sbt1-save (macos-15-intel) (push) Waiting to run
Validate cache / sbt1-save (windows-latest) (push) Waiting to run
Validate cache / sbt1-restore (macos-15-intel) (push) Blocked by required conditions
Validate cache / sbt1-restore (ubuntu-22.04) (push) Blocked by required conditions
Validate cache / sbt1-restore (windows-latest) (push) Blocked by required conditions
Validate cache / sbt2-restore (macos-15-intel) (push) Blocked by required conditions
Validate cache / sbt2-restore (ubuntu-22.04) (push) Blocked by required conditions
Validate cache / sbt2-restore (windows-latest) (push) Blocked by required conditions
Validate local file / Validate installation from local file Zulu (macos-latest) (push) Waiting to run
Validate local file / Validate installation from local file Zulu (windows-latest) (push) Waiting to run
Validate local file / Validate installation from local file Eclipse Temurin (macos-latest) (push) Waiting to run
Validate local file / Validate installation from local file Eclipse Temurin (windows-latest) (push) Waiting to run
Validate publishing functionality / Validate settings.xml (macos-latest) (push) Waiting to run
Validate publishing functionality / Validate settings.xml (windows-latest) (push) Waiting to run
Validate publishing functionality / settings.xml is overwritten if flag is true (macos-latest) (push) Waiting to run
Validate publishing functionality / settings.xml is overwritten if flag is true (windows-latest) (push) Waiting to run
Validate publishing functionality / settings.xml is not overwritten if flag is false (macos-latest) (push) Waiting to run
Validate publishing functionality / settings.xml is not overwritten if flag is false (windows-latest) (push) Waiting to run
Validate publishing functionality / settings.xml in custom location (macos-latest) (push) Waiting to run
Validate publishing functionality / settings.xml in custom location (windows-latest) (push) Waiting to run
Validate Java e2e smoke / microsoft 25 (jdk) - macos-latest (push) Waiting to run
Validate Java e2e smoke / microsoft 25 (jdk) - windows-latest (push) Waiting to run
Validate Java e2e smoke / temurin 11 (jdk) - macos-latest (push) Waiting to run
Validate Java e2e smoke / temurin 25 (jdk) - macos-latest (push) Waiting to run
Validate Java e2e smoke / temurin 17 (jdk) - windows-latest (push) Waiting to run
Validate Java e2e smoke / temurin 25 (jdk) - windows-latest (push) Waiting to run
Validate cache / gradle-save (ubuntu-latest) (push) Failing after 5m11s
Validate cache / maven-save (ubuntu-latest) (push) Failing after 36s
Validate cache / sbt-save (ubuntu-22.04) (push) Failing after 35s
Validate cache / gradle1-save (ubuntu-latest) (push) Failing after 4m53s
Validate cache / maven1-save (ubuntu-latest) (push) Failing after 34s
Validate cache / sbt1-save (ubuntu-22.04) (push) Failing after 35s
Validate cache / custom-maven-path-save (push) Failing after 34s
Validate cache / custom-maven-path-restore (push) Skipped
Validate local file / Validate installation from local file Zulu (ubuntu-latest) (push) Failing after 36s
Validate local file / Validate installation from local file Eclipse Temurin (ubuntu-latest) (push) Failing after 36s
Validate publishing functionality / Validate settings.xml (ubuntu-latest) (push) Failing after 36s
Validate publishing functionality / settings.xml is overwritten if flag is true (ubuntu-latest) (push) Failing after 41s
Validate publishing functionality / settings.xml is not overwritten if flag is false (ubuntu-latest) (push) Failing after 36s
Validate publishing functionality / settings.xml in custom location (ubuntu-latest) (push) Failing after 19s
Validate publishing functionality / Maven dependencies repositories (push) Waiting to run
Validate publishing functionality / Maven plugins repositories (push) Waiting to run
Validate publishing functionality / Maven both repositories (push) Waiting to run
Validate Java e2e smoke / liberica 21 (jdk+fx) - ubuntu-latest (push) Failing after 39s
Validate Java e2e smoke / microsoft 25 (jdk) - ubuntu-latest (push) Successful in 1m25s
Validate Java e2e smoke / temurin 21 (jdk) - ubuntu-latest (push) Failing after 32s
Validate Java e2e smoke / temurin 25 (jdk) - ubuntu-latest (push) Failing after 34s
Validate Java e2e smoke / zulu 17 (jre) - ubuntu-latest (push) Successful in 32s
Security analysis with zizmor / Analyze workflows with zizmor (push) Failing after 13m9s
Support Maven plugin repositories in generated settings.xml (#1286)
* Add Maven plugin repository support

Generate plugin repositories alongside dependency repositories and share Central inclusion and ordering controls. Cover repository parsing, credentials, explicit Central overrides, plugin ordering, and effective Maven models; document the compatibility change and rebuild runtime bundles.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 52a8a8e2-7965-42d3-88d9-d66f64d0d60d

* Fix CI audit by updating Handlebars to 4.7.10

Update the transitive test dependency to the patched release without changing runtime dependencies or suppressing audit checks.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 282b173f-7b1d-4fcd-bca4-9c8e2fa72a37

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 52a8a8e2-7965-42d3-88d9-d66f64d0d60d
Copilot-Session: 282b173f-7b1d-4fcd-bca4-9c8e2fa72a37
2026-10-14 16:11:40 -04:00

289 lines
11 KiB
YAML

name: Validate publishing functionality
on:
push:
branches:
- main
- releases/*
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
permissions:
contents: read
defaults:
run:
shell: pwsh
jobs:
setup-java-publishing:
name: Validate settings.xml
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
steps:
- name: Checkout
uses: actions/checkout@v7
with:
persist-credentials: false
- name: setup-java
uses: ./
id: setup-java
with:
distribution: 'temurin'
java-version: '11'
server-id: maven
server-username-env-var: MAVEN_USERNAME
server-password-env-var: MAVEN_CENTRAL_TOKEN
gpg-passphrase-env-var: MAVEN_GPG_PASSPHRASE
- name: Validate settings.xml
run: |
$xmlPath = Join-Path $HOME ".m2" "settings.xml"
Get-Content $xmlPath | ForEach-Object { Write-Host $_ }
$content = [System.IO.File]::ReadAllText($xmlPath)
$expected = @(
'<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"'
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'
' xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">'
' <interactiveMode>false</interactiveMode>'
' <servers>'
' <server>'
' <id>maven</id>'
' <username>${env.MAVEN_USERNAME}</username>'
' <password>${env.MAVEN_CENTRAL_TOKEN}</password>'
' </server>'
' </servers>'
'</settings>'
) -join "`n"
if ($content -ne $expected) {
Write-Host "Expected settings.xml:"
$expected -split "`n" | ForEach-Object { Write-Host $_ }
throw "Generated XML file is incorrect"
}
test-publishing-overwrite:
name: settings.xml is overwritten if flag is true
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
steps:
- name: Checkout
uses: actions/checkout@v7
with:
persist-credentials: false
- name: Create fake settings.xml
run: |
$xmlDirectory = Join-Path $HOME ".m2"
$xmlPath = Join-Path $xmlDirectory "settings.xml"
New-Item -Path $xmlDirectory -ItemType Directory
Set-Content -Path $xmlPath -Value "Fake_XML"
- name: setup-java
uses: ./
id: setup-java
with:
distribution: 'temurin'
java-version: '11'
server-id: maven
server-username-env-var: MAVEN_USERNAME
server-password-env-var: MAVEN_CENTRAL_TOKEN
gpg-passphrase-env-var: MAVEN_GPG_PASSPHRASE
- name: Validate settings.xml is overwritten
run: |
$xmlPath = Join-Path $HOME ".m2" "settings.xml"
Get-Content $xmlPath | ForEach-Object { Write-Host $_ }
$content = Get-Content $xmlPath -Raw
if ($content -notlike '*maven*') {
throw "settings.xml file is not overwritten"
}
test-publishing-skip-overwrite:
name: settings.xml is not overwritten if flag is false
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
steps:
- name: Checkout
uses: actions/checkout@v7
with:
persist-credentials: false
- name: Create fake settings.xml
run: |
$xmlDirectory = Join-Path $HOME ".m2"
$xmlPath = Join-Path $xmlDirectory "settings.xml"
New-Item -Path $xmlDirectory -ItemType Directory
Set-Content -Path $xmlPath -Value "Fake_XML"
- name: setup-java
uses: ./
id: setup-java
with:
distribution: 'temurin'
java-version: '11'
server-id: maven
server-username-env-var: MAVEN_USERNAME
server-password-env-var: MAVEN_CENTRAL_TOKEN
overwrite-settings: false
gpg-passphrase-env-var: MAVEN_GPG_PASSPHRASE
- name: Validate that settings.xml is not overwritten
run: |
$xmlPath = Join-Path $HOME ".m2" "settings.xml"
$content = Get-Content -Path $xmlPath -Raw
Write-Host $content
if ($content -notlike "*Fake_XML*") {
throw "settings.xml file was overwritten but it should not be"
}
test-publishing-custom-location:
name: settings.xml in custom location
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
steps:
- name: Checkout
uses: actions/checkout@v7
with:
persist-credentials: false
- name: setup-java
uses: ./
id: setup-java
with:
distribution: 'temurin'
java-version: '11'
server-id: maven
server-username-env-var: MAVEN_USERNAME
server-password-env-var: MAVEN_CENTRAL_TOKEN
gpg-passphrase-env-var: MAVEN_GPG_PASSPHRASE
settings-path: ${{ runner.temp }}
- name: Validate settings.xml location
run: |
$path = Join-Path $env:RUNNER_TEMP "settings.xml"
if (-not (Test-Path $path)) {
throw "settings.xml file is not found in expected location"
}
test-maven-repositories:
name: Maven ${{ matrix.repositories }} repositories
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
repositories: [dependencies, plugins, both]
steps:
- name: Checkout
uses: actions/checkout@v7
with:
persist-credentials: false
- name: Prepare Maven model inspection
run: |
$directory = Join-Path $env:RUNNER_TEMP "maven-repository-test"
New-Item -Path $directory -ItemType Directory -Force | Out-Null
$pomPath = Join-Path $directory "pom.xml"
$warmSettingsPath = Join-Path $directory "warm-settings.xml"
$cachePath = Join-Path $directory "repository"
$outputPath = Join-Path $directory "warm-effective-pom.xml"
# This project repository keeps the inspection plugin available offline
# after the generated settings disable inherited plugin Central.
@'
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<groupId>setup-java.test</groupId>
<artifactId>repository-settings</artifactId>
<version>1.0</version>
<pluginRepositories>
<pluginRepository>
<id>inspection</id>
<url>https://repo.maven.apache.org/maven2</url>
</pluginRepository>
</pluginRepositories>
</project>
'@ | Set-Content -Path $pomPath
'<settings />' | Set-Content -Path $warmSettingsPath
mvn --batch-mode --no-transfer-progress --settings $warmSettingsPath `
"-Dmaven.repo.local=$cachePath" --file $pomPath `
org.apache.maven.plugins:maven-help-plugin:3.5.1:effective-pom `
"-Doutput=$outputPath"
if ($LASTEXITCODE -ne 0) {
throw "Could not prepare the Maven Help Plugin"
}
- name: Configure dependency and plugin repositories
uses: ./
with:
distribution: 'temurin'
java-version: '21'
settings-path: ${{ runner.temp }}/maven-repository-test/settings
mvn-server-credentials: |
private:PRIVATE_USERNAME:PRIVATE_TOKEN
mvn-repositories: ${{ matrix.repositories != 'plugins' && 'private:https://repo.example.invalid/maven:false' || '' }}
mvn-plugin-repositories: ${{ matrix.repositories != 'dependencies' && 'private:https://repo.example.invalid/maven:false' || '' }}
mvn-repositories-include-central: false
- name: Validate generated settings and effective Maven repositories
env:
REPOSITORY_CONFIGURATION: ${{ matrix.repositories }}
run: |
$directory = Join-Path $env:RUNNER_TEMP "maven-repository-test"
$settingsPath = Join-Path $directory "settings/settings.xml"
[xml]$settings = Get-Content -Path $settingsPath -Raw
$profiles = @($settings.settings.profiles.profile)
if ($profiles.Count -ne 1 -or $profiles[0].id -ne "setup-java-repositories") {
throw "Expected one repository profile"
}
$activeProfiles = @($settings.settings.activeProfiles.activeProfile)
if ($activeProfiles.Count -ne 1 -or $activeProfiles[0] -ne "setup-java-repositories") {
throw "Expected one active repository profile"
}
$server = $settings.settings.servers.server
if ($server.id -ne "private" -or $server.username -ne '${env.PRIVATE_USERNAME}' -or $server.password -ne '${env.PRIVATE_TOKEN}') {
throw "Repository credentials were not preserved"
}
function Assert-Repositories($repositories, $expectPrivate, $context) {
$central = @($repositories | Where-Object { $_.id -eq "central" })
if ($central.Count -ne 1 -or $central[0].releases.enabled -ne "false" -or $central[0].snapshots.enabled -ne "false") {
throw "$context did not disable inherited Maven Central"
}
$private = @($repositories | Where-Object { $_.id -eq "private" })
$expectedCount = if ($expectPrivate) { 1 } else { 0 }
if ($private.Count -ne $expectedCount) {
throw "$context has incorrect private repositories"
}
if ($expectPrivate -and ($private[0].url -ne "https://repo.example.invalid/maven" -or $private[0].snapshots.enabled -ne "false")) {
throw "$context has incorrect private repository settings"
}
}
$expectDependencies = $env:REPOSITORY_CONFIGURATION -ne "plugins"
$expectPlugins = $env:REPOSITORY_CONFIGURATION -ne "dependencies"
Assert-Repositories @($profiles[0].repositories.repository) $expectDependencies "Settings dependency repositories"
Assert-Repositories @($profiles[0].pluginRepositories.pluginRepository) $expectPlugins "Settings plugin repositories"
$pomPath = Join-Path $directory "pom.xml"
$cachePath = Join-Path $directory "repository"
$outputPath = Join-Path $directory "effective-pom.xml"
mvn --batch-mode --no-transfer-progress --offline --settings $settingsPath `
"-Dmaven.repo.local=$cachePath" --file $pomPath `
org.apache.maven.plugins:maven-help-plugin:3.5.1:effective-pom `
"-Doutput=$outputPath"
if ($LASTEXITCODE -ne 0) {
throw "Could not inspect the effective Maven model"
}
[xml]$effectivePom = Get-Content -Path $outputPath -Raw
Assert-Repositories @($effectivePom.project.repositories.repository) $expectDependencies "Effective dependency repositories"
Assert-Repositories @($effectivePom.project.pluginRepositories.pluginRepository) $expectPlugins "Effective plugin repositories"