I'm migrating a project from Spring Boot 4.0.x to 4.1.0.
The project uses protobuf but not grpc.
Build fails with
> ./gradlew build
> Task :generateProto FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':generateProto' (registered by plugin 'com.google.protobuf').
> Could not resolve all files for configuration ':protobufToolsLocator_grpc'.
> Could not find io.grpc:protoc-gen-grpc-java:null.
Searched in the following locations:
- https://nexus-dev.tech-on-air.com/repository/libs-release/io/grpc/protoc-gen-grpc-java/null/protoc-gen-grpc-java-null.pom
- https://nexus-dev.tech-on-air.com/repository/libs-snapshot/io/grpc/protoc-gen-grpc-java/null/protoc-gen-grpc-java-null.pom
- https://nexus-dev.tech-on-air.com/repository/repo/io/grpc/protoc-gen-grpc-java/null/protoc-gen-grpc-java-null.pom
- https://repo.maven.apache.org/maven2/io/grpc/protoc-gen-grpc-java/null/protoc-gen-grpc-java-null.pom
Required by:
root project 'philoctetes'
I suspect that is because Spring Boot automagically (because of the protobuf plugin) tries to configure the grpc plugin. But that's not there (and not needed).
build.gradle is
import org.apache.tools.ant.filters.ReplaceTokens
//file:noinspection GroovyAssignabilityCheck
buildscript {
ext {
protobufVersion = '4.35.1'
}
}
plugins {
id 'java'
id 'idea'
id 'jacoco'
id 'io.freefair.lombok' version '9.5.0'
id 'org.springframework.boot' version '4.1.0'
id 'io.spring.dependency-management' version '1.1.7'
id 'com.google.cloud.tools.jib' version '3.5.3'
id 'com.google.protobuf' version '0.10.0'
id 'org.cyclonedx.bom' version '3.2.4'
id 'org.gradlex.jvm-dependency-conflict-detection' version '2.5'
id 'org.gradlex.jvm-dependency-conflict-resolution' version '2.5'
}
repositories {
maven { url = 'https://nexus-dev.tech-on-air.com/repository/libs-release' }
maven { url = 'https://nexus-dev.tech-on-air.com/repository/libs-snapshot' }
maven { url = 'https://nexus-dev.tech-on-air.com/repository/repo' }
mavenCentral()
}
group = 'com.tyntec.mo'
java {
toolchain { languageVersion.set(JavaLanguageVersion.of(25)) }
}
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
configurations.configureEach {
exclude group: 'ch.qos.logback', module: 'logback-classic'
exclude group: 'org.apache.logging.log4j', module: 'log4j-slf4j-impl'
exclude group: 'org.slf4j', module: 'jcl-over-slf4j'
exclude group: 'org.slf4j', module: 'slf4j-reload4j'
exclude module: 'spring-boot-starter-logging'
}
dependencies {
implementation 'biz.paluch.logging:logstash-gelf:1.15.1'
implementation 'com.github.ulisesbocchio:jasypt-spring-boot-starter:4.0.4'
implementation("com.google.guava:guava:33.6.0-jre") because("protobuf pulls in old version")
implementation "com.google.protobuf:protobuf-java-util:${protobufVersion}"
implementation "com.google.protobuf:protobuf-java:${protobufVersion}"
implementation 'org.apache.commons:commons-lang3:3.20.0'
implementation 'org.jspecify:jspecify'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-amqp'
implementation 'org.springframework.boot:spring-boot-starter-kafka'
implementation 'org.springframework.boot:spring-boot-starter-log4j2'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-webmvc'
implementation 'org.springframework.cloud:spring-cloud-starter-bootstrap:5.0.2'
implementation 'org.springframework.cloud:spring-cloud-starter-kubernetes-client-config:5.0.2'
implementation 'org.springframework.kafka:spring-kafka'
implementation 'com.tyntec.hermes.mo.billing:hermesmo-billing-events:2.78'
runtimeOnly 'io.micrometer:micrometer-registry-prometheus'
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
testImplementation("org.apache.commons:commons-compress:1.28.0") because("org.springframework.cloud:spring-cloud-kubernetes-client-config pulls in old version")
testImplementation 'org.instancio:instancio-junit:5.6.0'
testImplementation 'org.springframework.amqp:spring-rabbit-test'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.boot:spring-boot-testcontainers'
testImplementation 'org.testcontainers:testcontainers-junit-jupiter'
testImplementation 'org.testcontainers:testcontainers-kafka'
testImplementation 'org.testcontainers:testcontainers-rabbitmq'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
tasks.named('test') {
useJUnitPlatform()
}
processResources {
from('src/main/resources') {
filter(ReplaceTokens, tokens: ["application.version": project.version])
}
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
protobuf {
protoc {
artifact = "com.google.protobuf:protoc:${protobufVersion}"
}
generateProtoTasks {
ofSourceSet('main')
}
}
tasks.withType(JavaCompile).configureEach {
options.compilerArgs.add("-parameters")
}
lombok {
version = "1.18.46"
}
tasks.cyclonedxBom {
// Configure JSON output (default: build/reports/cyclonedx-aggregate/bom.json)
jsonOutput.set(file("build/reports/cyclonedx/bom.json"))
}
jacocoTestReport {
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: [
"**/PhiloctetesApplication.class",
"**/com/google/protobuf/**/*.class",
"**/com/tyntec/billing/events/legacy/**/*.class",
"**/*Test*.class",
"**/com/tyntec/mo/philoctetes/integrationtest/*.class",
])
}))
}
reports {
xml.required = true
xml.outputLocation = file("build/jacoco.xml")
}
}
I'm migrating a project from Spring Boot 4.0.x to 4.1.0.
The project uses protobuf but not grpc.
Build fails with
I suspect that is because Spring Boot automagically (because of the protobuf plugin) tries to configure the grpc plugin. But that's not there (and not needed).
build.gradle is