Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import org.gradle.api.artifacts.Configuration
import org.gradle.api.artifacts.dsl.RepositoryHandler
import org.gradle.api.artifacts.repositories.ArtifactRepository
import org.gradle.api.artifacts.repositories.AuthenticationSupported
import org.gradle.api.artifacts.repositories.PasswordCredentials
import org.gradle.api.artifacts.repositories.UrlArtifactRepository
import org.gradle.api.attributes.AttributeContainer
import org.gradle.internal.deprecation.DeprecatableConfiguration
Expand Down Expand Up @@ -71,7 +72,10 @@ internal fun RepositoryHandler.associateNamesWithUrlsTo(repositories: MutableMap
* Convert this [UrlArtifactRepository] to an [OrtRepository] by extracting the relevant properties.
*/
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?

}
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed

return OrtRepositoryImpl(
url = url.toString(),
username = credentials?.username,
Expand Down
Loading