Skip to content

Instantly share code, notes, and snippets.

@jeusdi
Last active August 29, 2015 14:25
Show Gist options
  • Save jeusdi/c8b9b7c8ea28c37292df to your computer and use it in GitHub Desktop.
Save jeusdi/c8b9b7c8ea28c37292df to your computer and use it in GitHub Desktop.
Hibernate JPA model generator
apply plugin: 'java'
apply plugin: 'war'
webAppDirName = 'WebContent'
group = "living"
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
}
configurations {
jpamodelgen
}
sourceSets {
jpamodelgen {
java {
srcDirs = ['src/main/java/persistence/entities']
}
}
}
dependencies {
providedCompile group: 'javax', name: 'javaee-api', version:'7.0'
compile group: 'org.hibernate.ogm', name: 'hibernate-ogm-mongodb', version: '4.2.0.Final'
compile group: 'javax.validation', name:'validation-api', version:'1.1.0.Final'
compile group: 'com.fasterxml.jackson.jaxrs', name:'jackson-jaxrs-json-provider', version:'2.5.3'
compile group: 'org.elasticsearch', name:'elasticsearch', version: '1.5.2'
compile group: 'commons-configuration', name: 'commons-configuration', version: '1.10'
compile group: 'io.swagger', name: 'swagger-jaxrs', version: '1.5.0'
compile group: 'ma.glasnost.orika', name:'orika-core', version:'1.4.6'
compile project(':living_lib')
jpamodelgen group: 'org.hibernate', name: 'hibernate-jpamodelgen', version: '4.3.10.Final'
}
war {
archiveName = "living.war"
}
task generateMetamodel(type: JavaCompile, group: 'build', description: 'Generates the QueryDSL query types') {
source = sourceSets.jpamodelgen.java
classpath = configurations.compile + configurations.jpamodelgen
options.compilerArgs = [
"-proc:none"
]
destinationDir = sourceSets.jpamodelgen.java.srcDirs.iterator().next()
}
compileJava.dependsOn generateMetamodel
sourceSets.all {
output.resourcesDir = output.classesDir
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment