You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am currently working on externalizing common build steps of our projects (e.g. artefact publishing) using precompiled build scripts. In general this approach works fine but as soon as I try to apply the nebula.release plugin, the build fails with the following exception:
> Task :generatePrecompiledScriptPluginAccessors
Git repository not found at /Users/somebody/Projects/git.acme.com/gradle-plugins/build/tmp/generatePrecompiledScriptPluginAccessors/accessors3038685752906344908 -- nebula-release tasks will not be available. Use the git.root Gradle property to specify a different directory.
> Task :compileKotlin FAILED
e: /Users/somebody/Projects/git.acme.com/gradle-plugins/src/main/kotlin/com.acme.publish.gradle.kts: (6, 1): Unresolved reference: nebulaRelease
e: /Users/somebody/Projects/git.acme.com/gradle-plugins/src/main/kotlin/com.acme.publish.gradle.kts: (7, 5): Unresolved reference: addReleaseBranchPattern
e: /Users/somebody/Projects/git.acme.com/gradle-plugins/src/main/kotlin/com.acme.publish.gradle.kts: (40, 1): Expression 'release' cannot be invoked as a function. The function 'invoke()' is not found
e: /Users/somebody/Projects/git.acme.com/gradle-plugins/src/main/kotlin/com.acme.publish.gradle.kts: (40, 1): Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
internal val ComNetflixNebulaPluginGroup.release: PluginDependencySpec defined in gradle.kotlin.dsl.plugins._a06f7d6c83541c827fbf1cfda5baf9c1 in file PluginSpecBuilders.kt
internal val NebulaPluginGroup.release: PluginDependencySpec defined in gradle.kotlin.dsl.plugins._a06f7d6c83541c827fbf1cfda5baf9c1 in file PluginSpecBuilders.kt
e: /Users/somebody/Projects/git.acme.com/gradle-plugins/src/main/kotlin/com.acme.publish.gradle.kts: (40, 11): Unresolved reference: finalizedBy
e: /Users/somebody/Projects/git.acme.com/gradle-plugins/src/main/kotlin/com.acme.publish.gradle.kts: (40, 24): Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
internal val TaskContainer.publish: TaskProvider<DefaultTask> defined in gradle.kotlin.dsl.accessors._b7719bb009bf77985775c5b9fa4e40d9 in file Accessorsb13nju9doius8kxwhlptqirtr.kt
My gradle-plugins/build.gradle.kts looks like the following:
plugins {
`kotlin-dsl`
`kotlin-dsl-precompiled-script-plugins`
`maven-publish`
id("pl.allegro.tech.build.axion-release") version "1.14.0"
}
repositories {
mavenCentral()
}
group ="com.acme"
version = scmVersion.version
dependencies {
implementation("com.netflix.nebula:nebula-release-plugin:17.1.0")
}
publishing {
repositories {
maven {
url = uri("https://git.acme.com/api/v4/projects/1388/packages/maven")
name ="Acme.com-GitLab"
credentials(HttpHeaderCredentials::class) {
name ="Job-Token"
value =System.getenv("CI_JOB_TOKEN")
}
authentication {
create<HttpHeaderAuthentication>("header")
}
}
}
}
While my precompiled script file gradle-plugins/src/main/kotlin/com.acme.publish.gradle.kts looks like the following:
plugins {
`maven-publish`
id("nebula.release")
}
nebulaRelease {
addReleaseBranchPattern("develop")
}
publishing {
publications {
create<MavenPublication>("maven") {
groupId = "com.acme"
artifactId = project.name
from(components["java"])
}
}
repositories {
maven {
val repoName = "Acme.com-GitLab"
val projectId = System.getenv("CI_PROJECT_ID")
val repoUrl = "https://git.acme.com/api/v4/projects/${projectId}/packages/maven"
val runsOnCi = System.getenv().containsKey("CI")
val tokenType = if (runsOnCi) { "Job-Token" } else { "Private-Token" }
val accessToken = if (runsOnCi) { System.getenv("CI_JOB_TOKEN") } else { System.getenv("GITLAB_API_TOKEN") }
url = uri(repoUrl)
name = repoName
credentials(HttpHeaderCredentials::class) {
name = tokenType
value = accessToken
}
authentication {
create<HttpHeaderAuthentication>("header")
}
}
}
}
release { finalizedBy (publish) }
According to a member of the gradle forums, this stems from an incompatibility of nebula.releas with the new way of applying plugins in gradle:
Well, that plugin is obviously not compatible with being applied in the plugins { ... } block of a precompiled script plugin.
You should open a feature request with them.
The plugins { ... } block of a precompiled script plugin is transplanted to a dummy project that is then evaluated and investigated to find out which typesafe accessors for Kotlin DSL should be generated.
To get rid of that warning you would need to apply the plugin the legacy way using apply instead of the plugins { ... } block.
To make your plugin compile and work, you need to use the uglier longer raw version instead of the accessors, so replace nebulaRelease { by configure {.
Would be happy, if I could use the new style of applying gradle plugins also with the nebula plugin.
The text was updated successfully, but these errors were encountered:
I am currently working on externalizing common build steps of our projects (e.g. artefact publishing) using precompiled build scripts. In general this approach works fine but as soon as I try to apply the
nebula.release
plugin, the build fails with the following exception:My
gradle-plugins/build.gradle.kts
looks like the following:While my precompiled script file
gradle-plugins/src/main/kotlin/com.acme.publish.gradle.kts
looks like the following:According to a member of the gradle forums, this stems from an incompatibility of
nebula.releas
with the new way of applying plugins in gradle:Would be happy, if I could use the new style of applying gradle plugins also with the nebula plugin.
The text was updated successfully, but these errors were encountered: