Created
August 6, 2015 11:28
-
-
Save sudarshan-webonise/3a5a05d89e7d4b240dad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'java' | |
repositories { | |
mavenCentral() | |
} | |
configurations { | |
reverseMap | |
} | |
dependencies { | |
reverseMap 'org.hibernate:hibernate-tools:4.0.0-CR1' | |
reverseMap 'org.slf4j:slf4j-simple:1.7.5' | |
reverseMap 'mysql:mysql-connector-java:5.1.6' | |
reverseMap files('/Users/jzwolak/local/lib/ojdbc6-11.2.0.2.0.jar') | |
compile 'javax:javaee-api:7.0' | |
} | |
project.ext { | |
hibernateRevEngXml = "$projectDir/config/hibernate.reveng.xml" | |
hibernateDestDir = file("$buildDir/generated") | |
} | |
task reverseMap { | |
inputs.files hibernateRevEngXml | |
outputs.dir hibernateDestDir | |
doLast { | |
hibernateDestDir.exists() || hibernateDestDir.mkdirs() | |
ant { | |
taskdef(name: 'hibernatetool', | |
classname: 'org.hibernate.tool.ant.HibernateToolTask', | |
classpath: configurations.reverseMap.asPath ) | |
hibernatetool( destdir : hibernateDestDir ) { | |
jdbcconfiguration( | |
configurationfile:"$projectDir/config/hibernate.cfg.xml", | |
revengfile:hibernateRevEngXml, | |
packagename:"src.main.java" | |
) | |
hbmtemplate( | |
templateprefix:"pojo/" , | |
template:"pojo/Pojo.ftl", | |
filepattern:"{package-name}/{class-name}.java" | |
) { | |
property(key:"jdk5",value:"true") | |
property(key:"ejb3",value:"true") | |
} | |
classpath { | |
pathelement( path: "config" ) | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment