Task :migrateToRefreshVersionsDependenciesConstants/refreshVersions FAILED
See original GitHub issueHi @LouisCAD ,I have been trying to use refreshVersions recently to optimize the dependencies used in the gradle files of my project.
I am sure that after checking the documentation many times, the current method is correct, but I don’t know why it still makes an error. I hope to get your advice.
My expected result:
Still based on the buildSrc method, split all the dependencies used in my project, such as all the dependencies in app/weight/helper, into buildSrc, such as Libs or Versions, and the build.gradle in the actual module can be directly Point attributes using the type name. And it also supports detecting whether the current dependency has the latest version.
In the first step, I upgraded my gradle to 6.4.1
./gradlew wrapper --gradle-version 6.4.1
The second step is to modify the contents of settings.gradle in the root directory
// settings.gradle.kts
import de.fayard.refreshVersions.RefreshVersionsSetup
// Here you might have some pluginManagement block:
pluginManagement {
//...
}
buildscript {
repositories {gradlePluginPortal()}
dependencies.classpath("de.fayard.refreshVersions:refreshVersions:0.9.5")
}
rootProject.name ='FingerAdvisor_Android'
include':app'
include':helper'
include':weight'
RefreshVersionsSetup.bootstrap(settings)
Then began to execute the command:
./gradlew migrateToRefreshVersionsDependenciesConstants --console=plain
I have been studying for a long time, and I don’t know where the problem occurred.
➜ xxx_Android git:(master) ✗ ./gradlew migrateToRefreshVersionsDependenciesConstants --console=plain
> Task :migrateToRefreshVersionsDependenciesConstants
All the following modules have hardcoded dependencies versions
1. :app (7)
2. :helper (1)
3. :weight (1)
4. Exit
Type the number of the Gradle module you want to migrate first:
weight
> Task :migrateToRefreshVersionsDependenciesConstants FAILED
> Task :refreshVersions FAILED
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':migrateToRefreshVersionsDependenciesConstants'.
> java.util.InputMismatchException (no error message)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':refreshVersions'.
> Couldn't resolve version for ModuleId(group=androidx.test.ext, name=junit)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================
* Get more help at https://help.gradle.org
BUILD FAILED in 10s
2 actionable tasks: 2 executed
➜ FingerAdvisor_Android git:(master) ✗
Issue Analytics
- State:
- Created 3 years ago
- Comments:10
Top GitHub Comments
Yes you are using the version placeholder correctly. BTW, instead of screenshotting issue comments, please give the link instead (get the permalink by clicking on the comment time/date next to the name of the commenter).
Great that you succeeded in using it correctly!
Regarding
buildSrc
we are providing an alternative to avoid you making frequent edits tobuildSrc
that would slow your builds down because of cache invalidations.Sorry for what I did just now.
The following example:
It seems to go against my original intention:
Is there any good solution?