I am generating metamodel classes for my entities using gradle.
plugins {
id "at.comm_unity.gradle.plugins.jpamodelgen" version "1.1.4"
}
jpaModelgen {
library = "org.hibernate:hibernate-jpamodelgen:5.3.3.Final"
jpaModelgenSourcesDir = "src/jpaModelgen/java"
}
sourceSets.main.java.srcDir file("src/jpaModelgen/java")
From gradle build
it works fine and compiling, but under IntelliJ when I try to build the project it gives me several errors for generated classes. While building all metamodel classes have problems with: error: package javax.persistence.metamodel does not exist
or error: cannot find symbol class XXXX
.
The strange thing about this is even if compiler marks errors after I open this class there are no problems with imports nor packages. What can I do to make build valid?
I changed build.gradle to:
apply plugin: 'idea'
dependencies {
compile group: 'org.hibernate', name: 'hibernate-jpamodelgen', version: '5.3.3.Final'
}
idea {
module {
sourceDirs += file("build/generated/src/main/java")
}
}
And it work now properly.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.