如何设置Hibernate Gradle插件来增强字节码? [英] How to setup Hibernate Gradle plugin for bytecode enhancement?
问题描述
hibernate-enhance-maven-plugin
,并提供构建时代码增强功能。 官方文档没有提及 apply plugin:'something'
line。如果我按照指导说的那样做:
无法为参数找到方法hibernate()...
我尝试用 apply plugin:'enhance'
来猜测插件名称(如这个线程建议)和 apply plugin:'org.hibernate.orm'
(as this test suggest),但它只是说该插件的id是未知的。
有没有人成功设置了这个插件?
我的build.gradle如下: p>
allprojects {
组'xxx'
版本'1.0-SNAPSHOT'
}
子项目{
apply plugin:'java'
sourceCompatibility = 1.8
repositories {
mavenLocal()
mavenCentral()
}
依赖关系{
...
}
}
项目(':xxx-model'){
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
依赖关系{
classpathorg.hibernate:hibernate-gradle-plugin:5.0。 7.Final
}
应用插件:'org.hibernate.orm'
hibernate {
enhance {}
...更多不相关的项目块在这里
通过将 buildscript {...}
移入根目录, allprojects
和子项目
,但没有有用的结果。
apply插件:'org.hibernate.orm'
插件代码表明您从测试中得到的是正确的。你可能缺少的是版本库
部分中的 buildScript
部分,以从中获取插件jar。
Hibernate Gradle plugin is an equivalent of hibernate-enhance-maven-plugin
and offers build-time code enhancements. The official docs do not mention the apply plugin: 'something'
line. If I just do as the guide says I get:
Could not find method hibernate() for arguments...
I tried guessing the plugin name with apply plugin: 'enhance'
(as this thread suggests) and apply plugin: 'org.hibernate.orm'
(as this test suggests) but it just says the plugin with that id is unknown.
Has anyone managed to set this plugin up successfully?
My build.gradle is as follows:
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
Experimented with moving the buildscript{...}
into the root, allprojects
and subprojects
with no useful results.
apply plugin: 'org.hibernate.orm'
The plugin code indicates what you got from the test is correct. What you may be missing is a repositories
section inside your buildScript
section, to fetch the plugin jar from.
这篇关于如何设置Hibernate Gradle插件来增强字节码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!