68 lines
1.5 KiB
Groovy
68 lines
1.5 KiB
Groovy
apply plugin: 'version-injection'
|
|
apply plugin: 'org.hibernate.build.gradle.xjc'
|
|
|
|
dependencies {
|
|
testCompile libraries.junit
|
|
testCompile libraries.jpa
|
|
testCompile project( ':hibernate-core' )
|
|
testCompile libraries.slf4j_api
|
|
testCompile libraries.slf4j_log4j
|
|
}
|
|
|
|
mavenPom {
|
|
name = 'Hibernate JPA 2 Metamodel Generator'
|
|
description = 'Annotation Processor to generate JPA 2 static metamodel classes'
|
|
}
|
|
|
|
versionInjection {
|
|
into( 'org.hibernate.jpamodelgen.Version', 'getVersionString' )
|
|
}
|
|
|
|
ext {
|
|
xjcTargetDir = file( "${buildDir}/generated-src/xjc/main" )
|
|
xsdDir = file( "${projectDir}/src/main/xsd" )
|
|
}
|
|
|
|
sourceSets.main {
|
|
java.srcDir xjcTargetDir
|
|
resources.srcDir xsdDir
|
|
}
|
|
|
|
compileTestJava {
|
|
options.compilerArgs += [
|
|
"-proc:none"
|
|
]
|
|
}
|
|
|
|
jar {
|
|
manifest {
|
|
attributes 'Implementation-Title' : '${project.name}',
|
|
'Implementation-Version' : '${project.version}'
|
|
}
|
|
}
|
|
|
|
task jaxb {
|
|
// configure Gradle up-to-date checking
|
|
inputs.dir( xsdDir )
|
|
outputs.dir( xjcTargetDir )
|
|
|
|
// perform actions
|
|
doLast {
|
|
xjcTargetDir.mkdirs()
|
|
|
|
ant.taskdef(name: 'xjc', classname: 'org.jvnet.jaxb2_commons.xjc.XJC2Task', classpath: configurations.xjc.asPath)
|
|
|
|
ant.xjc(
|
|
destdir: ( xjcTargetDir as File ).absolutePath,
|
|
package: 'org.hibernate.jpamodelgen.xml.jaxb',
|
|
extension: 'true'
|
|
) {
|
|
schema ( dir: xsdDir.path, includes: "*.xsd" )
|
|
}
|
|
}
|
|
}
|
|
tasks.compileJava.dependsOn jaxb
|
|
|
|
checkstyleMain.exclude '**/jaxb/**'
|
|
|