java-tutorials/gradle-modules/gradle-customization/gradle-protobuf/build.gradle

45 lines
820 B
Groovy
Raw Normal View History

plugins {
id 'java'
id "com.google.protobuf" version "0.8.18"
}
group = 'com.baeldung'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'
repositories {
mavenCentral()
}
dependencies {
implementation group: 'com.google.protobuf', name: 'protobuf-java', version: '3.15.0'
implementation group: 'javax.annotation', name: 'javax.annotation-api', version: '1.3.2'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
}
tasks.named('test') {
useJUnitPlatform()
}
protobuf {
protoc {
artifact = 'com.google.protobuf:protoc:3.15.0'
}
}
sourceSets {
main {
proto {
srcDir 'src/sample_protofiles'
}
java {
srcDirs 'build/generated/source/proto/main/java'
}
}
test {
proto {
srcDir 'src/sample_protofiles'
}
}
}