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

91 lines
2.5 KiB
Groovy
Raw Normal View History

/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
apply plugin: 'version-injection'
apply plugin: 'org.hibernate.build.gradle.xjc'
dependencies {
testCompile libraries.junit
testCompile libraries.jpa
testCompile project( ':hibernate-core' )
}
mavenPom {
name = 'Hibernate JPA 2 Metamodel Generator'
description = 'Annotation Processor to generate JPA 2 static metamodel classes'
}
dependencies {
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Java 9 ftw!
if ( JavaVersion.current().isJava9Compatible() ) {
// The JDK used to run Gradle is Java 9+, and we assume that that is the same
// JDK for executing tasks
xjc( 'com.sun.xml.bind:jaxb-impl:2.2.11' )
xjc( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' )
xjc( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' )
xjc( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' )
xjc( 'javax:javaee-api:7.0' )
testRuntime( 'com.sun.xml.bind:jaxb-impl:2.2.11' )
testRuntime( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' )
testRuntime( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' )
testRuntime( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' )
testRuntime( 'javax:javaee-api:7.0' )
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
}
2013-11-24 16:16:12 -05:00
ext {
xjcTargetDir = file( "${buildDir}/generated-src/xjc/main" )
2013-11-24 16:16:12 -05:00
xsdDir = file( "${projectDir}/src/main/xsd" )
}
sourceSets.main {
java.srcDir xjcTargetDir
2013-11-24 16:16:12 -05:00
resources.srcDir xsdDir
}
2013-11-22 20:46:05 -05:00
compileTestJava {
options.compilerArgs += [
"-proc:none"
]
}
jar {
manifest {
2016-03-02 21:07:16 -05:00
attributes 'Implementation-Title' : name,
'Implementation-Version' : version,
'Specification-Title' : name,
'Specification-Version' : version
}
}
task jaxb {
// configure Gradle up-to-date checking
2013-11-24 16:16:12 -05:00
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'
) {
2013-11-24 16:16:12 -05:00
schema ( dir: xsdDir.path, includes: "*.xsd" )
}
}
}
tasks.compileJava.dependsOn jaxb
checkstyleMain.exclude '**/jaxb/**'