Skip to content

I am using Kotlin + Spring Boot Gradle Project , Getting error Cannot access 'publish': it is private in 'BootBuildImage' #25453

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pugazhendhit opened this issue Feb 26, 2021 · 5 comments
Labels
status: superseded An issue that has been superseded by another type: documentation A documentation update

Comments

@pugazhendhit
Copy link

pugazhendhit commented Feb 26, 2021

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'

image


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 = "[email protected]"
		}
	}
}


@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Feb 26, 2021
@pugazhendhit pugazhendhit changed the title Cannot access 'publish': it is private in 'BootBuildImage' I am using Kotlin + Spring Boot Gradle Project , Getting error Cannot access 'publish': it is private in 'BootBuildImage' Feb 26, 2021
@jnizet
Copy link
Contributor

jnizet commented Feb 26, 2021

You simply have to use

isPublish = true

or

setPublish(true)

@wilkinsona
Copy link
Member

Thanks, @jnizet.

@wilkinsona wilkinsona added status: invalid An issue that we don't feel is valid and removed status: waiting-for-triage An issue we've not yet triaged labels Feb 26, 2021
@wilkinsona
Copy link
Member

wilkinsona commented Feb 26, 2021

Our Kotlin example in the docs is wrong. We're missing a few tests in PackagingDocumentationTests as well.

@wilkinsona wilkinsona reopened this Feb 26, 2021
@wilkinsona wilkinsona added type: documentation A documentation update and removed status: invalid An issue that we don't feel is valid labels Feb 26, 2021
@jnizet
Copy link
Contributor

jnizet commented Feb 26, 2021

@wilkinsona Note that the wrong publish property is used in the plugin documentation. I'm working on a PR to fix it.

@snicoll
Copy link
Member

snicoll commented Feb 27, 2021

Closing in favor of PR #25454

@snicoll snicoll closed this as completed Feb 27, 2021
@snicoll snicoll removed this from the 2.4.x milestone Feb 27, 2021
@snicoll snicoll added status: superseded An issue that has been superseded by another type: documentation A documentation update and removed type: documentation A documentation update labels Feb 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: superseded An issue that has been superseded by another type: documentation A documentation update
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants