I want add JPA metamodel to my project - Spring boot + gradle
I find a lot of examles how can i do it but all with Maven
. Also I find this site: https://plugins.gradle.org/search?term=metamodel
and try first three plugins. With each plugins I get errors: error: cannot find symbol
in classes marked lombok @Builder
annotation and some classes is not entity
. It is example some plugin:
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "com.github.iboyko.gradle.plugins:jpamodelgen-plugin:1.0.1"
}
}
dependencies {
compile ('org.hibernate:hibernate-jpamodelgen')
}
1) Which plugin or method is the most official (correct) to create JPA metamodel
in Spring boot + spring-data-jpa + gradle
?
2) How can I specify only the package with entities
and not scan another classes?
3) how to make friends with it with lombok
?
EDIT
I add this code to gradle file:
sourceSets.configureEach { sourceSet ->
tasks.named(sourceSet.compileJavaTaskName).configure {
options.annotationProcessorGeneratedSourcesDirectory = file("$buildDir/generated/sources/java")
}
}
and it generate classes_
fine. After that I mark
generated/sources/java
folder ass root of generated classes(rigth clik to this folder and mark as)
After that I try import generated classes in my repository and IDE show this:
For each module I have 2 module - my_module
and my_module_main
(I don't understand why) and all classes generate in my_module
but all code in my_module_main
. If I add this dependency - I have this: