plugins { id 'nu.studer.jooq' id 'io.spring.dependency-management' id 'org.springframework.boot' apply false } dependencies { implementation "org.jooq:jooq:${jooqVersion}" implementation "org.jooq:jooq-codegen:${jooqVersion}" implementation 'org.springframework.boot:spring-boot-starter-data-jdbc' jooqGenerator "mysql:mysql-connector-java:${mysqlConnectorVersion}" // include self to use strategy jooqGenerator project(':dao') } sourceSets { main { java.srcDirs += 'generated-src/jooq/main/java' } } jooq { version = "${jooqVersion}" edition = nu.studer.gradle.jooq.JooqEdition.OSS configurations { databasir { generateSchemaSourceOnCompilation = true generationTool { jdbc { driver = 'com.mysql.cj.jdbc.Driver' url = 'jdbc:mysql://localhost:3306/databasir' user = 'root' password = '123456' properties { property { key = 'useSSL' value = 'false' } property { key = 'allowPublicKeyRetrieval' value = 'true' } } } generator { name = 'org.jooq.codegen.DefaultGenerator' database { name = 'org.jooq.meta.mysql.MySQLDatabase' inputSchema = 'databasir' excludes = 'flyway.*' forcedTypes { forcedType { name = 'BOOLEAN' includeExpression = 'deleted|enabled|is.*|use_ssl' includeTypes = '.*' } forcedType { name = 'varchar' includeExpression = '.*' includeTypes = 'INET' } forcedType { userType = 'com.databasir.dao.enums.OAuthAppType' converter = 'com.databasir.dao.converter.OAuthAppTypeConverter' includeExpression = 'app_type' includeTypes = '.*' } forcedType { userType = 'com.databasir.dao.enums.DocumentTemplatePropertyType' converter = 'com.databasir.dao.converter.DocumentTemplatePropertyTypeConverter' includeExpression = 'document_template_property.type' includeTypes = '.*' } forcedType { userType = 'com.databasir.dao.enums.MockDataType' converter = 'com.databasir.dao.converter.MockDataTypeConverter' includeExpression = 'mock_data_rule.mock_data_type' includeTypes = '.*' } forcedType { userType = 'com.databasir.dao.enums.ProjectSyncTaskStatus' converter = 'com.databasir.dao.converter.ProjectSyncTaskStatusConverter' includeExpression = 'project_sync_task.status' includeTypes = '.*' } } } generate { pojos = true } target { packageName = 'com.databasir.dao' directory = 'generated-src/jooq/main/java' } strategy.name = 'com.databasir.dao.strategy.DatabasirPojoNamingStrategy' } } } } } checkstyleMain.source = "src/main/java"