Hi I am getting the following message when trying to generate classes from
my SQL Server database.
I am using gradle to generate the classes. I tested my gradle task agains a
MySQL database and it works.
build.gradle looks as follows.
buildscript {
ext {
generatedSourcesDir = file("src/main/generated")
generatedSourcesPackage = 'com.hsa.paretoetl.domain'
hibernateJpaApiVersion = '1.0.0.Final'
springBootVersion = '1.2.6.RELEASE'
jodaTimeVersion = '2.8.2'
jadiraVersion = '3.2.0.GA'
jtdsVersion = '1.3.1'
yamlVersion = '1.14'
}
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath
'io.spring.gradle:dependency-management-plugin:0.5.2.RELEASE'
classpath "org.yaml:snakeyaml:${yamlVersion}"
classpath "net.sourceforge.jtds:jtds:${jtdsVersion}"
classpath fileTree(dir: 'libs/JOOQ/JOOQ-lib', include: '*.jar', exclude:
'jooq-scala-*.jar')
}
}
apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'
apply plugin: 'io.spring.dependency-management'
springBoot {
mainClass = "com.hsa.paretoetl.Application"
}
/*
* Make java files visible only to the groovy compiler plugin
*/
sourceSets {
main {
java {
srcDirs = []
}
groovy {
srcDirs = ['src/main/java', 'src/main/groovy', generatedSourcesDir]
}
}
test {
java {
srcDirs = []
}
groovy {
srcDirs = ['src/test/java', 'src/test/groovy']
}
}
}
jar {
baseName = 'pareto-etl'
version = '0.1'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
}
// Import Spring Boot's bom, spring-boot-dependencies
dependencyManagement {
imports {
mavenBom
"org.springframework.boot:spring-boot-dependencies:${springBootVersion}"
}
}
ext['spring-data-releasetrain.version'] = 'Gosling-RELEASE'
dependencies {
compile 'org.springframework.boot:spring-boot-starter-data-jpa'
compile 'org.springframework.boot:spring-boot-starter-jdbc'
compile "org.springframework.boot:spring-boot-configuration-processor"
compile 'org.codehaus.groovy:groovy-all'
compile 'org.apache.commons:commons-lang3:3.4'
compile 'org.bgee.log4jdbc-log4j2:log4jdbc-log4j2-jdbc4.1:1.16'
compile "org.jadira.usertype:usertype.core:${jadiraVersion}"
compile "joda-time:joda-time:${jodaTimeVersion}"
compile 'joda-time:joda-time-hibernate:1.4'
compile 'javax.inject:javax.inject:1'
compile 'javax.el:el-api:2.2'
compile 'org.hibernate:hibernate-validator:5.2.1.Final'
compile fileTree(dir: 'libs/JOOQ/JOOQ-lib', include: 'jooq-*.jar', exclude:
'jooq-scala-*.jar')
runtime "net.sourceforge.jtds:jtds:${jtdsVersion}"
testCompile 'org.springframework.boot:spring-boot-starter-test'
}
eclipse {
classpath {
containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER')
containers
'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8'
}
}
task generateJooqSqlTypes(group: 'build', description: 'Generate JOOQ SQL
types') {
// Use your favourite XML builder to construct the code generation
configuration file
//
----------------------------------------------------------------------------------
def writer = new StringWriter()
def xml = new groovy.xml.MarkupBuilder(writer)
.configuration('xmlns': 'http://www.jooq.org/xsd/jooq-codegen-3.7.0.xsd') {
generator() {
database() {
name('org.jooq.util.sqlserver.SQLServerDatabase')
includes('.*')
inputSchema('LAB_Sandbox')
}
generate() {
}
target() {
packageName(generatedSourcesPackage)
directory(generatedSourcesDir)
}
}
}
// Run the code generator
// ----------------------
// the following does not work when using ntlmauth.dll for windows
authentication and sql server.
// use the solution below
// org.jooq.util.GenerationTool.generate(
// javax.xml.bind.JAXB.unmarshal(new
StringReader(writer.toString()), org.jooq.util.jaxb.Configuration.class)
// )
def props = file('src/main/resources/application.yml')
def config = new org.yaml.snakeyaml.Yaml().load(props.newReader())
def driver = config.spring.datasource.driver
def url = config.spring.datasource.url
def sql = groovy.sql.Sql.newInstance(url, driver)
def configuration = javax.xml.bind.JAXB.unmarshal(
new StringReader(writer.toString()),
org.jooq.util.jaxb.Configuration.class)
// test sql connection
def query = 'select top 1 * from member_info'
sql.eachRow(query) { println "test conn, member state is: ${it.mbrState}" }
new org.jooq.util.GenerationTool().with {
setConnection(sql.connection)
run(configuration)
}
}
task wrapper(type: Wrapper) {
gradleVersion = '2.7'
}
compileGroovy.dependsOn(processResources)
--
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.