I would like to be able to set a different repository path so that kotlin-dsl is accessed through that. We are working in a restricted network access and we proxy all maven dependencies through our internal nexus. I would like to be able to set our internal repository to get kotlin-dsl retrieved from.
Set a repository for buildSrc so that when we apply the plugin it checks the source through the given repository.
There is no way to set a repository to redirect where kotlin-dsl will be downloaded. Tried the following approach;
buildscript {
repositories {
maven(url = "internal nexus url")
}
}
plugins {
`kotlin-dsl`
}
It ignores the repository and still tries to download from https://plugins.gradle.org/m2/org/gradle/kotlin
Error resolving plugin [id: 'org.gradle.kotlin.kotlin-dsl', version: '0.13.1']
> Could not resolve all dependencies for configuration 'detachedConfiguration1'.
> Could not determine artifacts for org.gradle.kotlin.kotlin-dsl:org.gradle.kotlin.kotlin-dsl.gradle.plugin:0.13.1
> Could not get resource 'https://plugins.gradle.org/m2/org/gradle/kotlin/kotlin-dsl/org.gradle.kotlin.kotlin-dsl.gradle.plugin/0.13.1/org.gradle.kotlin.kotlin-dsl.gradle.plugin-0.13.1.jar'.
> Could not HEAD 'https://plugins.gradle.org/m2/org/gradle/kotlin/kotlin-dsl/org.gradle.kotlin.kotlin-dsl.gradle.plugin/0.13.1/org.gradle.kotlin.kotlin-dsl.gradle.plugin-0.13.1.jar'.
> Remote host closed connection during handshake
This issue basically blocks us to use kotlin-dsl at all.
Hi @yayaa,
Repositories for the plugins {} block are declared in your settings file, see https://docs.gradle.org/current/userguide/plugins.html#sec:plugin_management
The following should do:
// settings.gradle.kts
pluginManagement {
repositories {
maven(url = "internal nexus url")
// gradlePluginPortal()
}
}
Hey @eskatos , thank you so much for quick reply!
Just posting here as I am not able to make this to work. Tested with Gradle 4.10.3, 5.1, and 5.2.
Even with the configuration of pluginManagement in the first line of settings.gradle.kts, Gradle tries to resolve the kotlin-dsl declaration from buildSrc in Gradle Central Plugin Repository.
// settings.gradle.kts
pluginManagement {
repositories {
maven(url = "https://internalrepo.corp/artifactory")
}
}
// buildSrc/build.gradle.kts
plugins {
`kotlin-dsl`
}
repositories {
maven(url = "https://internalrepo.corp/artifactory")
}
But the script fails (our CI don't have internet access)
Build file '/Users/rdtoledo/Projects/project-android/buildSrc/build.gradle.kts' line: 1
* What went wrong:
Plugin [id: 'org.gradle.kotlin.kotlin-dsl', version: '1.1.3'] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'org.gradle.kotlin.kotlin-dsl:org.gradle.kotlin.kotlin-dsl.gradle.plugin:1.1.3')
Searched in the following repositories:
Gradle Central Plugin Repository
You have to add a settings.gradle[.kts] file to your buildSrc dir as well...
On Mon, Feb 4, 2019, 4:26 PM Rafael Toledo notifications@github.com wrote:
Just posting here as I am not able to make this to work. Tested with
Gradle 4.10.3, 5.1, and 5.2.Even with the configuration of pluginManagement in the first line of
settings.gradle.kts, Gradle tries to resolve the kotlin-dsl declaration
from buildSrc in Gradle Central Plugin Repository.// settings.gradle.kts
pluginManagement {
repositories {
maven(url = "https://internalrepo.corp/artifactory")
}
}// buildSrc/build.gradle.kts
plugins {
kotlin-dsl
}repositories {
maven(url = "https://internalrepo.corp/artifactory")
}But the script fails (our CI don't have internet access)
Build file '/Users/rdtoledo/Projects/project-android/buildSrc/build.gradle.kts' line: 1
What went wrong:
Plugin [id: 'org.gradle.kotlin.kotlin-dsl', version: '1.1.3'] was not found in any of the following sources:Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'org.gradle.kotlin.kotlin-dsl:org.gradle.kotlin.kotlin-dsl.gradle.plugin:1.1.3')
Searched in the following repositories:
Gradle Central Plugin Repository—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/gradle/kotlin-dsl/issues/1089#issuecomment-460289826,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AJwYe_WE8sRxq21MZEzm_hl1CI2gzucWks5vKFEkgaJpZM4Waks7
.
Exactly! Thank you! :)
Most helpful comment
Hi @yayaa,
Repositories for the
plugins {}block are declared in your settings file, see https://docs.gradle.org/current/userguide/plugins.html#sec:plugin_managementThe following should do: