I am using Kotlin + Spring Boot Gradle Project , Getting error Cannot access 'publish': it is private in 'BootBuildImage' when adding this BootBuildImage task plugin , any advise ?
build.gradle.kts:98:2: Cannot access 'publish': it is private in 'BootBuildImage'
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.springframework.boot.gradle.tasks.bundling.BootBuildImage
plugins {
id("org.springframework.boot") version "2.4.3"
id("io.spring.dependency-management") version "1.0.10.RELEASE"
kotlin("jvm") version "1.4.31"
kotlin("plugin.spring") version "1.4.31"
}
repositories {
mavenLocal()
mavenCentral()
maven("https://repo.spring.io/milestone")
maven("https://repo.spring.io/snapshot")
}
dependencyManagement {
imports {
mavenBom("org.springframework.cloud:spring-cloud-dependencies:${Versions.springCloud}")
}
}
dependencies {
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.springframework.boot:spring-boot-starter-webflux")
implementation("org.springframework.boot:spring-boot-starter-security")
implementation("org.springframework.cloud:spring-cloud-stream")
implementation("org.springframework.cloud:spring-cloud-starter-kubernetes")
implementation("org.springframework.cloud:spring-cloud-starter-kubernetes-config")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactor")
implementation("io.projectreactor.kotlin:reactor-kotlin-extensions")
implementation("net.logstash.logback:logstash-logback-encoder:${Versions.logback}")
implementation ("org.projectlombok:lombok:${Versions.lombok}")
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor")
testImplementation("org.springframework.boot:spring-boot-starter-test") {
exclude(group = "org.junit.vintage", module = "junit-vintage-engine")
}
testImplementation("io.projectreactor:reactor-test")
testImplementation("com.ninja-squad:springmockk:${Versions.springMock}")
}
tasks.getByName<org.springframework.boot.gradle.tasks.bundling.BootBuildImage>("bootBuildImage") {
imageName = "docker.example.com/library/${project.name}"
**publish = true**
docker {
publishRegistry {
username = "user"
password = "secret"
url = "https://docker.example.com/v1/"
email = "user@example.com"
}
}
}
Comment From: jnizet
You simply have to use
isPublish = true
or
setPublish(true)
Comment From: wilkinsona
Thanks, @jnizet.
Comment From: wilkinsona
Our Kotlin example in the docs is wrong. We're missing a few tests in PackagingDocumentationTests
as well.
Comment From: jnizet
@wilkinsona Note that the wrong publish
property is used in the plugin documentation. I'm working on a PR to fix it.
Comment From: snicoll
Closing in favor of PR #25454