Hibernate Gradle插件是
hibernate-enhance-maven-plugin
的等效物,提供构建时代码增强。官方文档没有提到apply plugin:'something'
这一行。如果我按照指南所说去做,我会得到如下错误信息:
我尝试了猜测插件的名称,使用了Could not find method hibernate() for arguments...
apply plugin:'enhance'
(如这个线程所建议)和apply plugin:'org.hibernate.orm'
(如这个测试所建议),但都提示该id对应的插件未知。
有人成功地设置了这个插件吗?
我的build.gradle如下:
allprojects {
group 'xxx'
version '1.0-SNAPSHOT'
}
subprojects {
apply plugin: 'java'
sourceCompatibility = 1.8
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
...
}
}
project(':xxx-model') {
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath "org.hibernate:hibernate-gradle-plugin:5.0.7.Final"
}
}
apply plugin: 'org.hibernate.orm'
hibernate {
enhance {}
}
}
... more unrelated project blocks here
尝试将 buildscript{...}
移动到根目录、allprojects
和 subprojects
中,但没有任何有用的结果。
hibernate-core
,我需要以下依赖项:hibernate-entitymanager
、hibernate-validator
、hibernate-validator-annotation-processor
、hibernate-commons-annotations
、hibernate-jpa-2.1-api
和hibernate-ehcache
吗? - Arashhibernate-core
就足够了? - Arashimplementation
代替compile
,因为它已经被标记为@Depricated
。 - stefan-dan