-
Notifications
You must be signed in to change notification settings - Fork 30
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
repositories
function clashes with Project.repositories
from the Kotlin DSL (Gradle 8.1)
#220
Comments
@YarnSphere seems to find a workaround: Regarding #208 (comment), where I say:
The less hacky workaround is simply: nexusPublishing {
this.repositories {
sonatype()
}
} Which I find acceptable (I don't know how I originally missed this 😅). I wonder if - in addition to mention it in the documentation - the plugin should do anything else (considering the backward compatibility)? |
This means the regression bug is in the IDE or the Gradle v IDEA integration. Is there a repro that we can use to report it to Gradle? |
Actually even with 8.1 it works fine here. |
This comment was marked as outdated.
This comment was marked as outdated.
Wouldn't know why or how and there is no reproducer project attached here, is there? |
This comment was marked as off-topic.
This comment was marked as off-topic.
Maybe Kotlin IntelliJ plugin version |
231-1.8.21-IJ9161.38 here |
This example project showcased this issue, last I checked (at the time I wrote the comment this issue references): https://github.com/YarnSphere/nexus-publish-gradle-8 The IDE would complain without the |
Interesting, with that it indeed happens |
Are you perhaps declaring your |
Yes and no, found the difference to mine. |
Btw. there is also this work-around: nexusPublishing.repositories {
sonatype()
} |
Is this reported to somewhere already? |
I just took the error message as an implication that this is an intended consequence of the changes being made to the resolution algorithm, i.e. that this isn't a bug per se. That's why I originally proposed the renaming/deprecation of the Do you believe this to be a bug that should be reported upstream? From the error message I assumed it's expected. |
Actually, I interpreted the error message the other way around. Also because I wonder why it should ever be the case, that it resolves to the extensions function And even if this resolution would "change soon", I don't think the IDE should display an error there for perfectly valid and working code, that is just non-sense and user unfriendly. So even if this is intended, it should imho be reported and change immediately by JetBrains. Btw. another work-around variant, maybe even better: nexusPublishing {
repositories.sonatype()
} |
Or another one: import org.gradle.kotlin.dsl.repositories as builtInRepositories
builtInRepositories {
mavenCentral()
}
nexusPublishing {
repositories {
sonatype()
}
} |
This is caused by an issue in IntelliJ idea: KTIJ-26463 |
KTIJ issue is fixed in 2023.3, can close? |
@YarnSphere , as an original reported, is it fixed for you in IDEA 2023.3? And thanks @3flex for the reminder :-). |
Seems fixed to me! Feel free to close! :) |
The
repositories
function is now clashing withProject.repositories
from the Kotlin DSL. For now it seems to still compile, but it does show an error in the IDE. Doing something like the following fixes it (since thankfully theProject.repositories
argument has a different name):It might make sense to introduce an alias to
repositories
such asnexusRepositories
and perhaps deprecate the former.If I'm missing something obvious and there's a less hacky workaround please do let me know!
I tried going over the Gradle release notes to check if this change in behaviour is mentioned anywhere but couldn't find anything to reference. I'd appreciate if someone could find a reference as to why this is now happening.
Also, please let me know if you'd prefer that I create a new issue to track this.
Originally posted by @YarnSphere in #208 (comment)
The text was updated successfully, but these errors were encountered: