gpt4 book ai didi

gradle - JOOQ代码生成给出错误标记是强制​​性的

转载 作者:行者123 更新时间:2023-12-03 03:46:58 27 4
gpt4 key购买 nike

我正在尝试将JOOQ与最新版本4.0.0的vertx一起使用。我想通过gradle生成我的Daos和表格。以下是我的build.gradle代码

buildscript {
ext {
vertx_jooq_version = '4.0.0'
postgresql_version = '42.2.2'
}
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath "io.github.jklingsporn:vertx-jooq-generate:$vertx_jooq_version"
classpath "org.postgresql:postgresql:$postgresql_version"
}
}

import groovy.xml.MarkupBuilder
import org.jooq.util.GenerationTool

import javax.xml.bind.JAXB

group 'your group id'
version 'your project version'

apply plugin: 'java'

dependencies {
compile "io.github.jklingsporn:vertx-jooq-classic:$vertx_jooq_version"
testCompile group: 'junit', name: 'junit', version: '4.12'
}

task jooqGenerate {
doLast() {
def writer = new StringWriter()
new MarkupBuilder(writer)
.configuration('xmlns': 'http://www.jooq.org/xsd/jooq-codegen-3.10.0.xsd') {
jdbc {
driver('org.postgresql.Driver')
url('jdbc:postgresql://IP:PORT/DATABASE')
user('YOUR_USER')
password('YOUR_PASSWORD')
}
generator {
name('io.github.jklingsporn.vertx.jooq.generate.classic.ClassicJDBCVertxGenerator')
database {
name('org.jooq.meta.postgres.PostgresDatabase')
include('.*')
excludes('schema_version')
inputSchema('public')
includeTables(true)
includeRoutines(true)
includePackages(false)
includeUDTs(true)
includeSequences(true)
}
generate([:]) {
deprecated(false)
records(false)
interfaces(true)
fluentSetters(true)
pojos(true)
daos(true)
}
target() {
packageName('io.one.sys.db')
directory("$projectDir/src/main/java")
}
strategy {
name('io.github.jklingsporn.vertx.jooq.generate.VertxGeneratorStrategy')
}
}
}
GenerationTool.generate(
JAXB.unmarshal(new StringReader(writer.toString()), org.jooq.meta.jaxb.Configuration.class)
)
}
}

它取自github链接 https://github.com/jklingsporn/vertx-jooq/tree/master/vertx-jooq-classic-jdbc

但是当我运行commmand ./gradlew jooqGenerate生成代码时,它给出了错误: The <generator/> tag is mandatory. For details, see http://www.jooq.org/xsd/jooq-codegen-3.11.0.xsd
我在JOOQ代码源库中检查了 org.jooq.codegen.GenerationTool。以下是代码
 org.jooq.meta.jaxb.Generator g = configuration.getGenerator();
if (g == null)
throw new GeneratorException("The <generator/> tag is mandatory. For details, see " + Constants.NS_CODEGEN);

链接: https://github.com/jOOQ/jOOQ/blob/master/jOOQ-codegen/src/main/java/org/jooq/codegen/GenerationTool.java

似乎在configuration.getGenerator()中出现问题;

以下是org.jooq.meta.jaxb.Generator文件的链接
https://github.com/jOOQ/jOOQ/blob/master/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/Generator.java

我看到以下方法
public Generator withGenerate(Generate value) {
setGenerate(value);
return this;
}

public void setGenerate(Generate value) {
this.generate = value;
}

我无法进一步挖掘谁应该调用withGenerate()方法来创建Generator对象。

谁能告诉我这是什么问题或jklingsporn库是否存在问题

最佳答案

终于明白了。
我必须将url http://www.jooq.org/xsd/jooq-codegen-3.10.0.xsd更新为http://www.jooq.org/xsd/jooq-codegen-3.11.0.xsd,因为xsd具有不同的版本

关于gradle - JOOQ代码生成给出错误<generator/>标记是强制​​性的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53650539/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com