I am unsuccessfully trying to use the JPA metamodel generator in my project. The following is my gradle.build file:
plugins {
id 'org.springframework.boot' version '2.7.5'
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
id 'java'
}
sourceCompatibility = '17'
def generatedSourcesDir = "${buildDir}/generated/sources/java"
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'jakarta.xml.bind:jakarta.xml.bind-api:3.0.0'
annotationProcessor 'org.hibernate:hibernate-jpamodelgen:6.1.5.Final'
compileOnly 'org.projectlombok:lombok:1.18.24'
runtimeOnly 'com.sun.xml.bind:jaxb-impl:3.0.1'
}
sourceSets.main.java.srcDirs += (generatedSourcesDir)
compileJava {
doFirst {
file(generatedSourcesDir).mkdirs()
}
options.compilerArgs += ['-AaddGenerationDate=true']
options.compilerArgs += ['-s', generatedSourcesDir]
// options.compilerArgs += '-proc:none'
println "Args for $name are $options.allCompilerArgs"
}
compileTestJava {
doFirst {
file(generatedSourcesDir).mkdirs()
}
options.compilerArgs += ['-AaddGenerationDate=true']
options.compilerArgs += ['-s', generatedSourcesDir]
options.compilerArgs += '-proc:none'
}
..... Other config excluded for brevity.
Running gradle compileJava
results in the following error message:
> Task :compileJava FAILED
Note: Hibernate JPA 2 Static-Metamodel Generator 6.1.5.Final
FAILURE: Build failed with an exception.