https://kotlinlang.org logo
#intellij
Title
# intellij
m

mbonnin

02/28/2024, 10:41 AM
What are the repositories used to download sources (tasks like
ijDownloadSources540ca63f-c44
). The task complains that it can't find
google()
but I'm pretty sure I've added it.
Adding
Copy code
repositories {
  mavenCentral()
  google()
}
to my root project build script worked even though
dependencyResolutionManagement.repositories
in
settings.gradle.kts
should have been enough
a

Anton Mefodichev

03/04/2024, 10:42 AM
Martin, is it possible to reproduce the issue in a simple project? Can you please attach it? Thank you!
m

mbonnin

03/04/2024, 10:55 AM
Can't reproduce on a simple project sadly. It happens in Apollo Kotlin but there's a lot of things going on down there. It might be that I'm misconfiguring some repositories or something. I was curious what repositories were used for the resolution
If you're curious, you can try to browse to an AGP symbol like
com.android.build.gradle.api.BaseVariant
and click the "Download Sources" button
But again, it might very well be something on my side
It says this:
Copy code
* What went wrong:
Configuration cache state could not be cached: field `__collectionProvider__` of task `:ijDownloadSources59cd943f-a1f` of type `IjDownloadTask`: error writing value of type 'org.gradle.api.internal.provider.DefaultProperty'
> Could not resolve all dependencies for configuration ':downloadSources_b2d901cc-d894-4e9b-83af-550d21ceb7b6'.
   > Could not find com.android.tools.build:gradle:8.0.0.
     Searched in the following locations:
       - <https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/8.0.0/gradle-8.0.0.pom>
       - file:/Users/mbonnin/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/ideaIC/223.8836.41/19e52733ac61e1d2e675720f92daf5959355cb1e/ideaIC-223.8836.41/com.android.tools.build/gradle/8.0.0/ivy-8.0.0.xml
       - file:/Users/mbonnin/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/ideaIC/223.8836.41/19e52733ac61e1d2e675720f92daf5959355cb1e/ideaIC-223.8836.41/gradle-8.0.0-2-withKotlin-withSources.xml
     Required by:
         project :
t

twisterrob

03/05/2024, 9:38 AM
Note that it's resolving a buildscript classpath element via project repositories. Those two are (should be) totally independent set of repos.
m

mbonnin

03/05/2024, 9:39 AM
Ah! interesting!
t

twisterrob

03/05/2024, 9:39 AM
@mbonnin if you disable CC, does it change the behavior?
m

mbonnin

03/05/2024, 9:39 AM
Let me try
Same
Ah but wait, there's something I missed before:
Copy code
> The project declares repositories, effectively ignoring the repositories you have declared in the settings.
   You can figure out how project repositories are declared by configuring your build to fail on project repositories.
Does IJ declare repositories blob thinking upside down?
What puzzles me is that it builds all fine, it's only an IDE thing
t

twisterrob

03/05/2024, 9:53 AM
Also if you add a println for gradle.initScripts (not sure of the exact property name), you should find the task definition in the temp folder and can read it, might help understand.
m

mbonnin

03/05/2024, 9:54 AM
Right, IDEA uses init scripts... I'll dig into this, thanks!
3 Views