My build failing on this exception ```Execution fa...
# dependency-management
t
My build failing on this exception
Copy code
Execution failed for task ':app:hiltAggregateDepsDefaulBackendTest'.
> Could not resolve all files for configuration ':app:defaultBackendTestRuntimeClasspath'.
   > Failed to transform protobuf-java-3.21.12-lite.jar (com.google.protobuf:protobuf-java:3.21.12) to match attributes {artifactType=aggregated-jar-for-hilt, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Could not find protobuf-java-3.21.12-lite.jar (com.google.protobuf:protobuf-java:3.21.12).
        Searched in the following locations:
            <https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-java/3.21.12/protobuf-java-3.21.12-lite.jar>
And it makes no sense, there is
-lite
classifier, there is nothing like that in reality, the right path is
Copy code
<https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-java/3.21.12/protobuf-java-3.21.12.jar>
How to found source of that classifier definition please? Gradle has generally very bad support for maven classifiers
gradlew dependencies
will not print it. It is even not possible to exclude it.
t
Did you try
gradlew :app:dependencyInsight --configuration hiltAggregateDepsDefaultBackendTest --dependency protobuf-java
? (maybe try with another configuration too)
t
I found this, but I was not able to found any working configuraion. I tried
RuntimeClasspath
and
CompileClasspath
Now I tried the full task name as you suggest ant it also ends up with `configuration `hiltAggregateDepsDefaultBackendTest`' not found in configuration container.`
It's Android project
t
Oops, sorry, I meant
--configuration defaultBackendTestRuntimeClasspath
(as printed in the error message)
t
also not found 😞
I tried it also with app: prefix also nothing
t
Grab a known configuration from
gradlew :app:dependencies
(note the
:app
prefix here, just in case) then try the
:app:dependencyInsight
with the configuration. Or you could run
gradlew :app:dependencies
redirecting the output to a file, then search for protobuf-java in that file; that should tell you (like dependencyInsight, but with fewer details) where protobuf-java comes from, and possibly changes in versions between the declared one (that could have had a
lite
variant) and selected one (that no longer has). And to fix that, Gradle gives you many many tools, e.g. module metadata rules so you can remove the lite classifier from the declared dependency for the module that depends on protobuf-java with that classifier (classifiers are a half-thought-out Maven solution to "variants", a thing of the past –or specifically for Maven that has no other means of expressing such things–, where Gradle has true variant support).
t
Yes, gradlew appdependencies has 381k lines. There is many sections like
Copy code
androidJdkImage - Configuration providing JDK image for compiling Java 9+ sources
No dependencies

androidTestAnnotationProcessor - Classpath for the annotation processor for 'androidTest'. (n)
No dependencies

androidTestApi (n)
No dependencies

androidTestApiDependenciesMetadata
No dependencies

androidTestAvastAnnotationProcessor - Classpath for the annotation processor for 'androidTestAvast'. (n)
No dependencies

androidTestAvastApi (n)
No dependencies
And even many with real tree like
Copy code
androidTestImplementationDependenciesMetadata
+--- androidx.compose.ui:ui-test-junit4 -> 1.5.4
|    +--- androidx.compose.ui:ui-test:1.5.4
|    |    +--- androidx.compose.runtime:runtime:1.5.4
|    |    |    \--- androidx.compose.runtime:runtime-saveable:1.5.4 (c)
|    |    +--- androidx.compose.ui:ui:1.5.4
|    |    |    +--- androidx.compose.runtime:runtime-saveable:1.5.4
|    |    |    |    +--- androidx.compose.runtime:runtime:1.5.4 (*)
|    |    |    |    \--- androidx.compose.runtime:runtime:1.5.4 (c)
But nothing works in
Copy code
* What went wrong:
configuration 'androidTestImplementationDependenciesMetadata' not found in configuration container.
But I meantime simple go trough source code of all ours libraries and I found one which defines this classifier. Luckily there was not so many of them. Ideal would be if
gradlew app:dependencies
would simply print that 😞
Thanks!