hibernate-orm/tooling/metamodel-generator/hibernate-jpamodelgen.gradle

71 lines
1.6 KiB
Groovy
Raw Normal View History

apply plugin: 'version-injection'
dependencies {
testCompile libraries.junit
testCompile libraries.jpa
testCompile project( ':hibernate-core' )
testCompile libraries.slf4j_api
testCompile libraries.slf4j_log4j
}
def pomName() {
return 'Hibernate JPA 2 Metamodel Generator'
}
def pomDescription() {
return 'Annotation Processor to generate JPA 2 static metamodel classes'
}
versionInjection {
into( 'org.hibernate.jpamodelgen.Version', 'getVersionString' )
}
2013-11-24 16:16:12 -05:00
ext {
jaxbTargetDir = file( "${buildDir}/generated-sources/jaxb/main" )
xsdDir = file( "${projectDir}/src/main/xsd" )
}
sourceSets.main {
2013-11-24 16:16:12 -05:00
java.srcDir jaxbTargetDir
resources.srcDir xsdDir
}
2013-11-22 20:46:05 -05:00
compileTestJava {
options.compilerArgs += [
"-proc:none"
]
}
jar {
manifest {
attributes 'Implementation-Title' : '${project.name}',
'Implementation-Version' : '${project.version}'
}
}
task jaxb {
// configure Gradle up-to-date checking
2013-11-24 16:16:12 -05:00
inputs.dir( xsdDir )
outputs.dir( jaxbTargetDir )
// perform actions
doLast {
jaxbTargetDir.mkdirs()
ant.taskdef(name: 'xjc', classname: 'org.jvnet.jaxb2_commons.xjc.XJC2Task', classpath: configurations.jaxb.asPath)
ant.jaxbTargetDir = jaxbTargetDir
ant.xjc(
destdir: '${jaxbTargetDir}',
package: 'org.hibernate.jpamodelgen.xml.jaxb',
extension: 'true'
) {
2013-11-24 16:16:12 -05:00
schema ( dir: xsdDir.path, includes: "*.xsd" )
}
}
}
2013-12-02 21:53:19 -05:00
runSourceGenerators.dependsOn jaxb
checkstyleMain.exclude '**/jaxb/**'