I’m trying to use the hibernate tool ant task on my build file. I’m using a custom configuration but for some reason some dependencies are not being resolve.
- What went wrong: Execution failed for task ‘:core:generate’. Cause: Could not resolve all dependencies for configuration ‘:core:hbtool’. Cause: Could not find group:org.hibernate, module:hibernate-core, version:3.5.6.Final. Required by:
com.somepackage:core:1.0-SNAPSHOT
- Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 19.173 secs
This is our build file wich is a migration from a very old Maven project:
subprojects {
apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'idea'
apply plugin: 'eclipse'
// *** Cobertura Plugin ***
//apply from: 'https://github.com/valkolovos/gradle_cobertura/raw/master/ivy/gradle_cobertura/gradle_cobertura/1.0-rc4/coberturainit.gradle'
repositories {
mavenLocal()
maven {
url 'http://maven.springframework.org/milestone'
}
maven {
url 'https://repository.jboss.org/nexus/content/repositories/releases'
}
maven {
url 'http://sass-java.googlecode.com/svn/repo'
}
mavenCentral()
}
version = '1.0-SNAPSHOT'
group = 'com.somepackage'
targetCompatibility = '1.6'
sourceCompatibility = '1.6'
// *** Needed for Groovy Java joint compilation ***
sourceSets.main.java.srcDirs = []
sourceSets.main.groovy.srcDir 'src/main/java'
sourceSets.test.java.srcDirs = []
sourceSets.test.groovy.srcDir 'src/test/java'
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
configurations {
compile.transitive = true
testCompile.transitive = true
all*.exclude group: 'commons-logging'
}
//*** Versions ***
springVersion = '3.0.6.RELEASE'
springSecurityVersion = '3.0.6.RELEASE'
aspectjVersion = '1.6.12'
tilesVersion = '2.2.2'
slf4jVersion = '1.6.4'
hibernateVersion = '3.5.6.Final'
dependencies {
groovy('org.codehaus.groovy:groovy-all:1.7.0')
testCompile('junit:junit:4.10', 'org.easymock:easymock:3.1', 'dumbster:dumbster:1.6', 'xmlunit:xmlunit:1.3')
compile(
// ** Spring **
"org.springframework:spring-core:$springVersion",
"org.springframework:spring-context:$springVersion",
"org.springframework:spring-aop:$springVersion",
"org.springframework:spring-aspects:$springVersion",
"org.springframework:spring-tx:$springVersion",
"org.springframework:spring-jdbc:$springVersion",
"org.springframework:spring-orm:$springVersion",
"org.springframework:spring-web:$springVersion",
"org.springframework:spring-webmvc:$springVersion",
"org.springframework:spring-context-support:$springVersion",
"org.springframework:spring-test:$springVersion",
// ** Spring Security **
"org.springframework.security:spring-security-core:$springSecurityVersion",
"org.springframework.security:spring-security-config:$springSecurityVersion",
"org.springframework.security:spring-security-web:$springSecurityVersion",
"org.springframework.security:spring-security-taglibs:$springSecurityVersion",
// ** AspectJ **
"org.aspectj:aspectjweaver:$aspectjVersion",
"org.aspectj:aspectjrt:$aspectjVersion",
// ** Apache Tiles **
"org.apache.tiles:tiles-core:$tilesVersion",
"org.apache.tiles:tiles-jsp:$tilesVersion",
// ** Apache Commons **
'commons-fileupload:commons-fileupload:1.2.1',
'commons-digester:commons-digester:2.0',
'commons-lang:commons-lang:2.6',
'commons-pool:commons-pool:1.5.4',
'commons-codec:commons-codec:1.5',
// ** BoneCP **
'com.jolbox:bonecp:0.7.1.RELEASE',
// ** SLF4J **
"org.slf4j:slf4j-api:$slf4jVersion",
"org.slf4j:jcl-over-slf4j:$slf4jVersion",
"org.slf4j:log4j-over-slf4j:$slf4jVersion",
// ** LogBack **
'ch.qos.logback:logback-core:1.0.0',
'ch.qos.logback:logback-classic:1.0.0',
// ** Other **
'joda-time:joda-time:2.0',
'org.codehaus.jackson:jackson-mapper-asl:1.9.1',
'cglib:cglib-nodep:2.2.2',
// ** Database **
'mysql:mysql-connector-java:5.1.18',
// ** Javax **
'javax.mail:mail:1.4.1',
'javax.activation:activation:1.1.1',
'javax.servlet:jstl:1.2',
'javax.transaction:jta:1.1',
'javax.validation:validation-api:1.0.0.GA',
// ** DWR **
'org.directwebremoting:dwr:2.0.2'
)
}
}
project(':clv2-core') {
configurations {
hbtool
hbtool.transitive = true
}
processResources {
filter(org.apache.tools.ant.filters.ReplaceTokens,
tokens: [jdbcDriver: jdbcDriver,
jdbcUrl: jdbcUrl,
jdbcUsername: jdbcUsername,
jdbcPassword: jdbcPassword,
hibernateDialect: hibernateDialect])
}
task generate << {
ant {
taskdef(name: 'hibernatetool',
classname: 'org.hibernate.tool.ant.HibernateToolTask',
classpath: configurations.hbtool.asPath)
mkdir( dir: "$buildDir/generated" )
hibernatetool( destdir : "$buildDir/generated", properties: "$buildDir/resources/main/clv2-database.properties") {
annotationconfiguration( configurationfile:"$buildDir/resources/main/clv2-hibernate.cfg.xml" )
hbm2ddl( export: true, outputfilename: 'schema.sql' )
classpath {
pathelement( path: "$buildDir/resources/main" )
}
}
}
}
dependencies {
hbtool('org.hibernate:hibernate-tools:3.2.4.GA', "org.hibernate:hibernate-core:$hibernateVersion")
compile(
"org.hibernate:hibernate-core:$hibernateVersion",
'org.hibernate:hibernate-validator:4.2.0.Final',
'org.hibernate:hibernate-search:3.4.1.Final',
'org.hibernate:hibernate-annotations:3.5.6-Final',
'javax.servlet:servlet-api:2.5',
'jboss:javassist:3.6.ga',
'org.tmatesoft.svnkit:svnkit:1.3.5',
'net.sf.dozer:dozer:4.4',
'net.sf.ehcache:ehcache:1.4.1',
'quartz:quartz:1.5.2',
'org.apache.tika:tika-core:0.9',
'org.apache.tika:tika-parsers:0.9',
'org.apache.lucene:lucene-core:3.1.0',
'org.apache.lucene:lucene-snowball:3.0.3',
'org.apache.velocity:velocity:1.7',
'org.codehaus.woodstox:wstx-lgpl:3.2.2'
)
}
}
project(':web') {
apply plugin: 'war'
apply plugin: 'jetty'
dependencies {
providedCompile('javax.servlet:servlet-api:2.5', 'javax.el:el-api:1.0', 'javax.servlet.jsp:jsp-api:2.1')
compile project(':clv2-core')
compile('displaytag:displaytag:1.2') {
exclude(group: 'org.slf4j', name: 'jcl104-over-slf4j')
exclude(group: 'org.slf4j', name: 'slf4j-log4j12')
}
}
war {
baseName = 'web'
}
jettyRun {
contextPath = '/'
}
}
project(':importer') {
task(importer, dependsOn: 'classes', type: JavaExec) {
main = 'com.importer.Main'
classpath = sourceSets.main.runtimeClasspath
systemProperty 'import.csv', System.properties['import.csv']
systemProperty 'import.basepath', System.properties['import.basepath']
systemProperty 'import.filetype', System.properties['import.filetype']
}
dependencies {
compile project(':core')
compile('net.sf.opencsv:opencsv:2.1')
}
}
Any other tips or suggestions in general about the build file would be appreciated, since I’m new to Gradle.