Dear,
into my plugin I have build.gradle:
...
configuration{ reveng.extendsFrom(compile) }
dependencies {
repositories {
mavenCentral()
}
compile gradleApi()
compile localGroovy()
reveng "org.hibernate:hibernate-tools:4.3.1.CR1"
reveng "org.slf4j:slf4j-simple:1.7.5"
reveng "mysql:mysql-connector-java:5.1.34"
}
I do this to get after the corresponding classpath into my custom class Task
class RevengTask extends DefaultTask {
...
def String classPath
...
@TaskAction
def run(){
...
generateJava(project)
}
def generateJava(final Project project){
project.ant {
taskdef(name: 'hibernatetool',
classname: 'org.hibernate.tool.ant.HibernateToolTask',
classpath: classPath
)
hibernatetool( destdir : hibernateDir, templatepath : 'templates' ) {
jdbcconfiguration(
configurationfile:"${hibernateConfigXml.path}"
,
revengfile:"${hibernateRevEngXml.path}",
packagename:
"${projet.database.basePackage}"
)
hbm2java(
jdk5: true,
ejb3: true
)
classpath {
pathelement( path: "config" )
}
}
}
}
}
I tried here to use classPath properties which is defined like this:
class HibernatePlugin implements Plugin<Project>{
@Override
void apply(Project project) {
...
project.task("reveng", type: RevengTask ) {
...
classPath
= configurations.reveng.asPath
}
}
but in this case configurations is not in the scope, and if i use project.configurations this will use the configuations from the project who apply this plugins and not the plugins project.
I think they are a trick to do but I am too new in gradle to understand where I fail.
thanks for your help