Skip to content

fix(docs): Update System.env syntax for Gradle 9 compatibility#252

Merged
cwperks merged 1 commit intoopensearch-project:mainfrom
dbwiddis:fix-gradle-9-syntax
Aug 28, 2025
Merged

fix(docs): Update System.env syntax for Gradle 9 compatibility#252
cwperks merged 1 commit intoopensearch-project:mainfrom
dbwiddis:fix-gradle-9-syntax

Conversation

@dbwiddis
Copy link
Member

This PR updates the documentation for plugin Gradle build files to fix compatibility with Gradle 9.

Problem

The current syntax using $System.env.VARIABLE_NAME for accessing environment variables is not compatible with Gradle 9.

This format is used for Sonatype credentials for SNAPSHOT publication. This fails with under Gradle 9.

credentials {
    username = "$System.env.SONATYPE_USERNAME"
    password = "$System.env.SONATYPE_PASSWORD"
}

See example failed workflow here.

Solution

Update to use the System.getenv() method instead:

credentials {
    username = System.getenv("SONATYPE_USERNAME")
    password = System.getenv("SONATYPE_PASSWORD")
}

Example fix which restored successful snapshots: opensearch-project/opensearch-remote-metadata-sdk#245

PRs submitted org-wide to update:

Signed-off-by: Daniel Widdis <widdis@gmail.com>
@cwperks cwperks merged commit 9f0b610 into opensearch-project:main Aug 28, 2025
4 checks passed
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