jean
04/20/2021, 8:13 AMgradle.build
while using dependencyResolutionManagement
in settings.gradle
?
What I have so far:
// build.gradle.kts
repositories {
maven {
url = uri("<https://maven.pkg.jetbrains.space/myTeam/p/myProject/maven>")
credentials {
username = project.extra["space_usr"].toString()
password = project.extra["space_pwd"].toString()
}
}
}
// settings.gradle.kts
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
But I get the following error : Build was configured to prefer settings repositories over project repositories but repository 'maven' was added by build file 'app/build.gradle.kts'
If I remvove repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
then I get the following error :
Could not determine the dependencies of task ':app:kaptDebugKotlin'.
> Could not resolve all dependencies for configuration ':app:kotlinKaptWorkerDependencies'.
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.
See <https://docs.gradle.org/7.0-rc-1/userguide/declaring_repositories.html#sub:fail_build_on_project_repositories> for details.
> Could not find org.jetbrains.kotlin:kotlin-annotation-processing-gradle:1.4.32.
Searched in the following locations:
- <https://maven.pkg.jetbrains.space/>...
- <https://maven.pkg.jetbrains.space/>...
Required by:
project :app
I could add my custom maven dependency in settings.gradle.kts
but project.extra
is not accessible and requires clear textVampire
04/20/2021, 9:41 AMproject.extra
.
Using extra properties has actually very few valid use-cases and for all other use-cases it is either an error or there are better ways.
In your case project.findProperty
or project.property
would probably more appropriate as I guess you set those credentials as Gradle property and you can get Gradle properties from the settings object too.
And besides that, you might consider using the idiomatic way of credentials handling: https://docs.gradle.org/current/userguide/userguide_single.html#sec:handling_credentialsjean
04/20/2021, 5:54 PM