-
Notifications
You must be signed in to change notification settings - Fork 436
Use providers.gradleProperty()
#7801
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mernstcheckerframework
wants to merge
4
commits into
typetools:master
Choose a base branch
from
mernst:gradle-providers-get-property
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: typetools/checker-framework
Length of output: 165
🏁 Script executed:
Repository: typetools/checker-framework
Length of output: 302
🏁 Script executed:
Repository: typetools/checker-framework
Length of output: 50383
🌐 Web query:
Gradle maven-publish credentials username password null NullPointerException publish missing credentials💡 Result:
A NullPointerException (NPE) or "Username must not be null" error during Gradle publishing typically occurs when the
maven-publishplugin expects credentials for a repository but receives a null value for the username or password [1][2][3]. This error usually happens because the credentials are being resolved at configuration time, or the variables used to provide them (e.g., viafindPropertyorSystem.getenv) are missing or incorrectly configured [4][3][5]. To resolve or avoid this issue, follow these best practices: 1. Ensure properties are correctly named and defined: Verify that the properties you are accessing exist in yourgradle.propertiesfile,~/.gradle/gradle.properties, or as environment variables [6][3]. A common mistake is a mismatch between the property name in the build script and the name provided in the property file [3]. 2. Use secure credential management: Avoid hardcoding credentials in build scripts [6]. Instead, use external properties or environment variables [6][7]: credentials { username = project.findProperty("myRepoUsername")?: System.getenv("MY_REPO_USERNAME") password = project.findProperty("myRepoPassword")?: System.getenv("MY_REPO_PASSWORD") } 3. Debugging with Gradle Scan: If the error persists and is non-obvious, run your build with the--scanflag. This often reveals more detailed stack traces that can pinpoint exactly which part of the credential resolution is failing [1]. 4. Check for incompatible configurations: If you are using features like the Configuration Cache, ensure your credential handling is compatible [4]. In some cases, explicitly defining credentials that are not needed for certain tasks can cause issues; ensure you are only triggering publication tasks when credentials are actually available [6][5]. 5. Report misconfiguration: If you encounter an NPE rather than a helpful error message (like "Username must not be null"), it is often considered a bug in the plugin's error handling [1][2]. Double-check that you are not accidentally settingcredentialson a repository type that does not support them (e.g., some authentication methods do not use standard username/password credentials) [2].Citations:
Guard against null Sonatype credentials
orNullleavesusername/passwordunset when the properties are missing, andmaven-publishcan fail at publish time with an opaque NPE or “Username must not be null” instead of a clear missing-credentials error. Add an explicit check or fail-fast message for localpublishruns.🤖 Prompt for AI Agents