Skip to content

fix(Gradle): fix credentials checking in recent gradle releases#11887

Closed
losmateusz1 wants to merge 1 commit into
oss-review-toolkit:mainfrom
losmateusz1:fix/gradle8_credentials
Closed

fix(Gradle): fix credentials checking in recent gradle releases#11887
losmateusz1 wants to merge 1 commit into
oss-review-toolkit:mainfrom
losmateusz1:fix/gradle8_credentials

Conversation

@losmateusz1
Copy link
Copy Markdown
Contributor

with recent gradle8 releases (8.13.x or 8.14.x) gradle inspector fails with

IllegalStateException: Can not use getCredentials() method when not using PasswordCredentials; please use getCredentials(Class)

@losmateusz1 losmateusz1 force-pushed the fix/gradle8_credentials branch from 2519f4b to 05e9a6d Compare May 27, 2026 09:38
Signed-off-by: Mateusz Los <mateusz.los@extern.wenovate.de>
@losmateusz1 losmateusz1 force-pushed the fix/gradle8_credentials branch from 05e9a6d to 089505a Compare May 27, 2026 09:47
@losmateusz1 losmateusz1 marked this pull request as ready for review May 27, 2026 09:52
@losmateusz1 losmateusz1 requested a review from a team as a code owner May 27, 2026 09:52
@codecov
Copy link
Copy Markdown

codecov Bot commented May 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.31%. Comparing base (4eccaca) to head (089505a).

Additional details and impacted files
@@            Coverage Diff            @@
##               main   #11887   +/-   ##
=========================================
  Coverage     58.31%   58.31%           
  Complexity     1762     1762           
=========================================
  Files           356      356           
  Lines         13276    13276           
  Branches       1318     1318           
=========================================
  Hits           7742     7742           
  Misses         5049     5049           
  Partials        485      485           
Flag Coverage Δ
funTest-no-external-tools 30.61% <ø> (ø)
test-ubuntu-24.04 41.88% <ø> (ø)
test-windows-2025 41.86% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

internal fun UrlArtifactRepository.toOrtRepository(): OrtRepository {
val credentials = (this as? AuthenticationSupported)?.credentials
val credentials = (this as? AuthenticationSupported)?.let { authSupported ->
runCatching { authSupported.getCredentials(PasswordCredentials::class.java) }.getOrNull()
Copy link
Copy Markdown
Member

@sschuberth sschuberth May 27, 2026

Choose a reason for hiding this comment

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

Hmm. The original (parameter-less) getCredentials() function is still there (and Kotlin maps the getter to a property), so I'm unsure why this change should be needed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

the difference is that I used getCredentials(Class) instead of getCredentials(), I am not sure yet why gradle 8.14 fails on that, it may be because of the configuration of the project that I am currently checking

I will look into it some more, for now I don't see a better solution, I've run some tests and this approach will also work with older gradle releases

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@sschuberth the problem in my case was that there was a settings.gradle defined with HttpHeaderAuthentication that I missed, which made me thinking that there is an issue with parsing PasswordCredentials, I started working on a proper fix here #11927

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

So, should we close this PR already in favor of that other PR?

@losmateusz1 losmateusz1 marked this pull request as draft May 27, 2026 11:18
@losmateusz1 losmateusz1 marked this pull request as ready for review May 27, 2026 11:34
@losmateusz1 losmateusz1 marked this pull request as draft June 1, 2026 17:22
@losmateusz1 losmateusz1 closed this Jun 2, 2026
@losmateusz1 losmateusz1 deleted the fix/gradle8_credentials branch June 2, 2026 09:24
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.

3 participants