Hi Lukas,
I'm running into a problem when I try to define my own GeneratorStrategy.
The classloader doesn't find my strategy class and I can't figure out how
this can be solved.
I use jOOQ 3.7.3 to generate the code.
For creating the classes I've a gradle script which looks like this:
...
def dbProps = new Properties()
dbProps.load(new FileInputStream(System.getProperty("user.home") +
"/local.properties"))
ext {
database = [
host: dbProps.get("dbHost"),
port: dbProps.get("dbPort"),
schema: dbProps.get("dbSchema"),
user: dbProps.get("dbUser"),
password: dbProps.get("dbPwd")
]
jooqGen = [ metaSrcDir: "$buildDir/generated" ]
jdbcUrl =
"jdbc:mysql://${database.host}:${database.port}/${database.schema}"
}
defaultTasks 'jooqMetaGenerate'
configurations {
compile.extendsFrom generatedCompile
}
sourceSets {
generated
main {
compileClasspath += generated.output
output.classesDir = "$buildDir/classes"
output.resourcesDir = "$buildDir/resources"
java {
srcDirs += [jooqGen.metaSrcDir]
}
resources
}
}
dependencies {
generatedCompile 'org.jooq:jooq:3.7.3', 'org.jooq:jooq-meta:3.7.3',
'org.jooq:jooq-codegen:3.7.3'
...
}
...
task("jooqMetaGenerate") << {
Configuration configuration = new Configuration()
.withJdbc(new Jdbc()
.withUrl(jdbcUrl)
.withUser(database.user)
.withPassword(database.password))
.withGenerator(new Generator()
.withStrategy(new Strategy()
.withName('my.own.package.util.MyGeneratorStrategy'))
.withGenerate(new Generate()
.withValidationAnnotations(true)
.withPojos(true).withPojosEqualsAndHashCode(true).
withPojosToString(true).withImmutablePojos(true))
.withDatabase(new Database()
.withSchemata(new Schema()
.withInputSchema(database.schema)
.withOutputSchema(database.schema))
.withName("org.jooq.util.mysql.MySQLDatabase"))
.withTarget(new Target()
.withPackageName("my.own.package")
.withDirectory(jooqGen.metaSrcDir)));
GenerationTool.generate(configuration)
}
flywayMigrate.dependsOn clean
compileGeneratedJava.dependsOn jooqMetaGenerate
compileJava.dependsOn compileGeneratedJava
The "jooqMetaGenerate" task gives me the class not found exception:
Caused by: java.lang.ClassNotFoundException:
my.own.package.util.MyGeneratorStrategy
at org.jooq.util.GenerationTool.loadClass(GenerationTool.java:500)
at org.jooq.util.GenerationTool.run(GenerationTool.java:236)
at org.jooq.util.GenerationTool.generate(GenerationTool.java:180)
Any idea how I can make the classloader look for the strategy class?
Thanks in advance...
Cheers,
Christian
--
You received this message because you are subscribed to the Google Groups "jOOQ
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.