Slackbot
02/15/2023, 4:34 PMRobert Elliot
02/15/2023, 4:34 PMfun Configuration.isDeprecated() = this is DeprecatableConfiguration &&
resolutionAlternatives != null
fun ConfigurationContainer.resolveAll() = this
.filter { it.isCanBeResolved && !it.isDeprecated() }
.forEach { it.resolve() }
tasks.register("downloadDependencies") {
doLast {
configurations.resolveAll()
buildscript.configurations.resolveAll()
}
}Robert Elliot
02/15/2023, 4:35 PMExecution failed for task ':downloadDependencies'.
> Could not resolve all files for configuration ':testRuntimeOnlyDependenciesMetadata'.
> Could not find org.junit.platform:junit-platform-launcher:.
Required by:
project :Robert Elliot
02/15/2023, 4:36 PMChris Lee
02/15/2023, 4:38 PMRobert Elliot
02/15/2023, 4:40 PMdownloadDependencies task worked fine in gradle 7.6, and I can do a ./gradlew test quite happily in gradle 8, so whatever gradle needs to do to actually run the tests it can do.Robert Elliot
02/15/2023, 4:41 PMdownloadDependencies task is now broken - but I'm not sure how, so I'm not sure how to fix it.Vampire
02/15/2023, 4:45 PMkotlin-dsl plugin?
Afair the ...DependenciesMetadata tasks are added by the Kotlin plugin.Chris Lee
02/15/2023, 4:46 PMtestRuntimeOnlyDependenciesMetadata', for example? If so that configuration will need the junit BOM or otherwise have an artifact version specified.Robert Elliot
02/15/2023, 4:47 PMkotlin("jvm") version "1.8.10" for a couple of weeksVampire
02/15/2023, 4:47 PMRobert Elliot
02/15/2023, 4:47 PMVampire
02/15/2023, 4:47 PMVampire
02/15/2023, 4:48 PMRobert Elliot
02/15/2023, 5:03 PMfun ConfigurationContainer.resolveAll() = this
.filter { it.isCanBeResolved && !it.isDeprecated() }
.map { it.incoming.artifactView { isLenient = true } }
.forEach { it.files.files }Robert Elliot
02/15/2023, 5:29 PMdownloadDependencies should allow gradle to then work offline on that machine. I prove this by doing this:
RUN ./gradlew downloadDependencies
RUN --network=none ./gradlew build
in a Dockerfile
In the first project I tried the change above had the desired effect, but in a second project it didn't - the RUN --network=none ./gradlew build fails as so:
* What went wrong:
Execution failed for task ':compileGroovy'.
> Could not resolve all files for configuration ':detachedConfiguration3'.
> Could not resolve org.apache.groovy:groovy-astbuilder:4.0.9.
Required by:
project :
project : > org.apache.groovy:groovy:4.0.9 > org.apache.groovy:groovy-bom:4.0.9
> Could not resolve org.apache.groovy:groovy-astbuilder:4.0.9.
> Could not get resource '<https://repo.maven.apache.org/maven2/org/apache/groovy/groovy-astbuilder/4.0.9/groovy-astbuilder-4.0.9.pom>'.
> Could not GET '<https://repo.maven.apache.org/maven2/org/apache/groovy/groovy-astbuilder/4.0.9/groovy-astbuilder-4.0.9.pom>'.
> <http://repo.maven.apache.org|repo.maven.apache.org>
> Could not resolve org.apache.groovy:groovy-dateutil:4.0.9.
Required by:
project :
project : > org.apache.groovy:groovy:4.0.9 > org.apache.groovy:groovy-bom:4.0.9
> Could not resolve org.apache.groovy:groovy-dateutil:4.0.9.
> Could not get resource '<https://repo.maven.apache.org/maven2/org/apache/groovy/groovy-dateutil/4.0.9/groovy-dateutil-4.0.9.pom>'.
> Could not GET '<https://repo.maven.apache.org/maven2/org/apache/groovy/groovy-dateutil/4.0.9/groovy-dateutil-4.0.9.pom>'.
> <http://repo.maven.apache.org|repo.maven.apache.org>: Try againRobert Elliot
02/15/2023, 5:30 PMdownloadDependencies as a plugin, but obviously it needs to be robust to multiple different gradle setups.Robert Elliot
02/15/2023, 5:38 PMProject.getConfigurations() does not return detachedConfiguration3. Unclear yet whether it used to in Gradle 7.6, or if detachedConfiguration3 is some new thing in Gradle 8.Robert Elliot
02/15/2023, 5:41 PM--network=none so it was hidden from me.Robert Elliot
02/15/2023, 5:41 PMdetachedConfiguration3 coming from...Chris Lee
02/15/2023, 5:43 PMVampire
02/15/2023, 5:44 PMVampire
02/15/2023, 5:44 PMconfigurations as they are detached. 🙂Vampire
02/15/2023, 5:44 PMconfigurations.Vampire
02/15/2023, 5:45 PMRobert Elliot
02/15/2023, 5:45 PMVampire
02/15/2023, 5:45 PMRobert Elliot
02/15/2023, 5:46 PMThere could also be other tasks that do not use detached configurations, but just plainly download things using any other means and that might then even not work offline when run repeatedlyYes, I accept there's no way of working around that.
Vampire
02/15/2023, 5:46 PMRobert Elliot
02/15/2023, 5:54 PMVampire
02/15/2023, 6:01 PM