在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):ebean-orm-tools/ebean-gradle-plugin开源软件地址(OpenSource Url):https://github.com/ebean-orm-tools/ebean-gradle-plugin开源编程语言(OpenSource Language):Groovy 100.0%开源软件介绍(OpenSource Introduction):CreditCredit goes to khomich for his work https://github.com/khomich/gradle-ebean-enhancer - this plugin is based off that (with updated enhancement, kapt support etc). DocumentationRefer to http://ebean-orm.github.io/docs/tooling/gradle ebean-gradle-pluginPlugin that performs Enhancement (entity, transactional, query bean) and can generate query beans from entity beans written in Kotlin via kapt.
StatusCurrently using this with entity beans written in Kotlin (rather than Java). Example build.gradle (kotlin)group 'org.example'
version '1.0-SNAPSHOT'
buildscript {
ext.kotlin_version = '1.2.0'
ext.ebean_version = "11.24.1"
ext.postgresql_driver_version = "9.4.1207.jre7"
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "io.ebean:ebean-gradle-plugin:11.2.1"
}
}
apply plugin: 'kotlin'
apply plugin: 'io.ebean'
repositories {
mavenLocal()
mavenCentral()
}
sourceSets {
main.java.srcDirs += [file("$buildDir/generated/source/kapt/main")]
}
dependencies {
compile "org.postgresql:postgresql:$postgresql_driver_version"
compile "io.ebean:ebean:$ebean_version"
compile "io.ebean:ebean-querybean:11.24.1"
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
testCompile "org.avaje.composite:junit:1.1"
}
kapt {
generateStubs = true
}
ebean {
debugLevel = 1 //1 - 9
}
test {
useTestNG()
testLogging.showStandardStreams = true
testLogging.exceptionFormat = 'full'
}
Example build.gradle (java)Using the plugins DSL with Gradle >= 4.6:The recommended approach.
The recommended approach allows a single point of control for all processors. Particularly, the recommended approach allow to control the order of execution for processors. For example, if you use framework like Micronaut and Lombok at the same time it is necessary that Lombok runs before Micronaut processors. See in Micronaut docs. The same applies to querybean generation. If annotation processor runs behind Gradle ordering - it may lead to unpredictable results if you rely on annotation processors extensively. Use recommended approach to avoid such cases. import versions.* //from buildSrc
plugins {
id("io.ebean") version "<ebean_version>"
}
ebean {
debugLevel = 1 //1 - 9
// these two options no longer needed. Add "ebean-querybean" and "querybean-generator" to annotationProcessor config as below
// to control generation of query beans and versions of dependencies
// queryBeans = true
// generatorVersion = "<version>"
}
dependencies {
annotationProcessor("io.ebean:ebean-annotation:4.7")
annotationProcessor("io.ebean:ebean-querybean:<version>")
annotationProcessor("io.ebean:persistence-api:2.2.1")
annotationProcessor("io.ebean:querybean-generator:<version>")
implementation("io.ebean:ebean-annotation:4.7")
implementation("io.ebean:ebean-querybean:<version>")
implementation("io.ebean:ebean:<ebean_version>")
testImplementation("io.ebean.test:ebean-test-config:<version>")
}
test {
testLogging.showStandardStreams = true
} N.B. With Gradle >= 5.2 you can specify output directory for query bean like so compileJava.options.annotationProcessorGeneratedSourcesDirectory = file('generated')
//compileGroovy.options.annotationProcessorGeneratedSourcesDirectory = file('generated') For version <= import versions.* //from buildSrc
plugins {
id "io.ebean" version "<ebean_version>"
}
ebean {
debugLevel = 1 //1 - 9
queryBeans = true
generatorVersion = Deps.Versions.EBEAN_QUERY_GEN
}
dependencies {
// annotationProcessor(Deps.Libs.EBEAN_ANNOTATION) for ebean-gradle-plugin <= 11.36.1 - uncomment
implementation(Deps.Libs.EBEAN)
implementation(Deps.Libs.EBEAN_ANNOTATION)
implementation(Deps.Libs.EBEAN_QUERY)
testImplementation(Deps.Libs.EBEAN_TEST)
}
test {
testLogging.showStandardStreams = true
} Using the plugins DSL with Gradle version before 4.6:import versions.* //from buildSrc
plugins {
id("io.ebean") version "<ebean_version>"
}
configurations {
ebeanApt // for ebean-gradle-plugin <= 11.36.1 - just "apt"
}
ebean {
debugLevel = 1 //1 - 9
queryBeans = true
generatorVersion = Deps.Versions.EBEAN_QUERY_GEN
}
dependencies {
// annotationProcessor(Deps.Libs.EBEAN_ANNOTATION) for ebean-gradle-plugin <= 11.36.1 - uncomment
implementation(Deps.Libs.EBEAN)
implementation(Deps.Libs.EBEAN_ANNOTATION)
implementation(Deps.Libs.EBEAN_QUERY)
testImplementation(Deps.Libs.EBEAN_TEST)
}
test {
testLogging.showStandardStreams = true
} Using legacy plugin application:group 'org.example'
version '1.0-SNAPSHOT'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "io.ebean:ebean-gradle-plugin:11.36.1"
}
}
apply plugin: 'io.ebean'
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
compile "io.ebean:ebean:11.36.1"
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
testCompile "org.avaje.composite:junit:1.1"
}
ebean {
debugLevel = 1 //1 - 9
}
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论