Maven avro 插件给出架构尚未支持的错误
Maven avro plugin gives schema not yet supported error
在我的 maven 项目中,我使用 maven avro 插件从 avro 模式文件创建 Java 类。这是我从架构注册表中获得的 avro 文件。
{
"type":"record",
"name":"Envelope",
"namespace":"mongodb.company.price_service_company_calc_logs",
"fields":[
{
"name":"after",
"type":[
null,
{
"type":"string",
"connect.version":1,
"connect.name":"io.debezium.data.Json"
}
],
"default":null
},
{
"name":"patch",
"type":[
null,
{
"type":"string",
"connect.version":1,
"connect.name":"io.debezium.data.Json"
}
],
"default":null
},
{
"name":"filter",
"type":[
null,
{
"type":"string",
"connect.version":1,
"connect.name":"io.debezium.data.Json"
}
],
"default":null
},
{
"name":"source",
"type":{
"type":"record",
"name":"Source",
"namespace":"io.debezium.connector.mongo",
"fields":[
{
"name":"version",
"type":"string"
},
{
"name":"connector",
"type":"string"
},
{
"name":"name",
"type":"string"
},
{
"name":"ts_ms",
"type":"long"
},
{
"name":"snapshot",
"type":[
{
"type":"string",
"connect.version":1,
"connect.parameters":{
"allowed":true,
"last":false
},
"connect.default":false,
"connect.name":"io.debezium.data.Enum"
},
null
],
"default":false
},
{
"name":"db",
"type":"string"
},
{
"name":"rs",
"type":"string"
},
{
"name":"collection",
"type":"string"
},
{
"name":"ord",
"type":"int"
},
{
"name":"h",
"type":[
null,
"long"
],
"default":null
},
{
"name":"tord",
"type":[
null,
"long"
],
"default":null
}
],
"connect.name":"io.debezium.connector.mongo.Source"
}
},
{
"name":"op",
"type":[
null,
"string"
],
"default":null
},
{
"name":"ts_ms",
"type":[
null,
"long"
],
"default":null
}
],
"connect.name":"mongodb.company.price_service_company_calc_logs.Envelope"
}
每当我 运行 mvn package 它给我以下错误:
Execution default of goal org.apache.avro:avro-maven-plugin:1.9.2:schema failed: Schema not yet supported: null
有什么方法可以获得有关问题确切根源的更多信息?显然 maven -e 或 -X 开关没有多大帮助。
原来avro文件不正确。类型的所有空值都必须用双引号引起来。
{
"type":"record",
"name":"Envelope",
"namespace":"mongodb.company.price_service_company_calc_logs",
"fields":[
{
"name":"after",
"type":[
"null",
{
"type":"string",
"connect.version":1,
"connect.name":"io.debezium.data.Json"
}
],
"default":null
},
{
"name":"patch",
"type":[
"null",
{
"type":"string",
"connect.version":1,
"connect.name":"io.debezium.data.Json"
}
],
"default":null
},
{
"name":"filter",
"type":[
"null",
{
"type":"string",
"connect.version":1,
"connect.name":"io.debezium.data.Json"
}
],
"default":null
},
{
"name":"source",
"type":{
"type":"record",
"name":"Source",
"namespace":"io.debezium.connector.mongo",
"fields":[
{
"name":"version",
"type":"string"
},
{
"name":"connector",
"type":"string"
},
{
"name":"name",
"type":"string"
},
{
"name":"ts_ms",
"type":"long"
},
{
"name":"snapshot",
"type":[
{
"type":"string",
"connect.version":1,
"connect.parameters":{
"allowed":true,
"last":false
},
"connect.default":false,
"connect.name":"io.debezium.data.Enum"
},
"null"
],
"default":false
},
{
"name":"db",
"type":"string"
},
{
"name":"rs",
"type":"string"
},
{
"name":"collection",
"type":"string"
},
{
"name":"ord",
"type":"int"
},
{
"name":"h",
"type":[
"null",
"long"
],
"default":null
},
{
"name":"tord",
"type":[
"null",
"long"
],
"default":null
}
],
"connect.name":"io.debezium.connector.mongo.Source"
}
},
{
"name":"op",
"type":[
"null",
"string"
],
"default":null
},
{
"name":"ts_ms",
"type":[
"null",
"long"
],
"default":null
}
],
"connect.name":"mongodb.company.price_service_company_calc_logs.Envelope"
}
在我的 maven 项目中,我使用 maven avro 插件从 avro 模式文件创建 Java 类。这是我从架构注册表中获得的 avro 文件。
{
"type":"record",
"name":"Envelope",
"namespace":"mongodb.company.price_service_company_calc_logs",
"fields":[
{
"name":"after",
"type":[
null,
{
"type":"string",
"connect.version":1,
"connect.name":"io.debezium.data.Json"
}
],
"default":null
},
{
"name":"patch",
"type":[
null,
{
"type":"string",
"connect.version":1,
"connect.name":"io.debezium.data.Json"
}
],
"default":null
},
{
"name":"filter",
"type":[
null,
{
"type":"string",
"connect.version":1,
"connect.name":"io.debezium.data.Json"
}
],
"default":null
},
{
"name":"source",
"type":{
"type":"record",
"name":"Source",
"namespace":"io.debezium.connector.mongo",
"fields":[
{
"name":"version",
"type":"string"
},
{
"name":"connector",
"type":"string"
},
{
"name":"name",
"type":"string"
},
{
"name":"ts_ms",
"type":"long"
},
{
"name":"snapshot",
"type":[
{
"type":"string",
"connect.version":1,
"connect.parameters":{
"allowed":true,
"last":false
},
"connect.default":false,
"connect.name":"io.debezium.data.Enum"
},
null
],
"default":false
},
{
"name":"db",
"type":"string"
},
{
"name":"rs",
"type":"string"
},
{
"name":"collection",
"type":"string"
},
{
"name":"ord",
"type":"int"
},
{
"name":"h",
"type":[
null,
"long"
],
"default":null
},
{
"name":"tord",
"type":[
null,
"long"
],
"default":null
}
],
"connect.name":"io.debezium.connector.mongo.Source"
}
},
{
"name":"op",
"type":[
null,
"string"
],
"default":null
},
{
"name":"ts_ms",
"type":[
null,
"long"
],
"default":null
}
],
"connect.name":"mongodb.company.price_service_company_calc_logs.Envelope"
}
每当我 运行 mvn package 它给我以下错误:
Execution default of goal org.apache.avro:avro-maven-plugin:1.9.2:schema failed: Schema not yet supported: null
有什么方法可以获得有关问题确切根源的更多信息?显然 maven -e 或 -X 开关没有多大帮助。
原来avro文件不正确。类型的所有空值都必须用双引号引起来。
{
"type":"record",
"name":"Envelope",
"namespace":"mongodb.company.price_service_company_calc_logs",
"fields":[
{
"name":"after",
"type":[
"null",
{
"type":"string",
"connect.version":1,
"connect.name":"io.debezium.data.Json"
}
],
"default":null
},
{
"name":"patch",
"type":[
"null",
{
"type":"string",
"connect.version":1,
"connect.name":"io.debezium.data.Json"
}
],
"default":null
},
{
"name":"filter",
"type":[
"null",
{
"type":"string",
"connect.version":1,
"connect.name":"io.debezium.data.Json"
}
],
"default":null
},
{
"name":"source",
"type":{
"type":"record",
"name":"Source",
"namespace":"io.debezium.connector.mongo",
"fields":[
{
"name":"version",
"type":"string"
},
{
"name":"connector",
"type":"string"
},
{
"name":"name",
"type":"string"
},
{
"name":"ts_ms",
"type":"long"
},
{
"name":"snapshot",
"type":[
{
"type":"string",
"connect.version":1,
"connect.parameters":{
"allowed":true,
"last":false
},
"connect.default":false,
"connect.name":"io.debezium.data.Enum"
},
"null"
],
"default":false
},
{
"name":"db",
"type":"string"
},
{
"name":"rs",
"type":"string"
},
{
"name":"collection",
"type":"string"
},
{
"name":"ord",
"type":"int"
},
{
"name":"h",
"type":[
"null",
"long"
],
"default":null
},
{
"name":"tord",
"type":[
"null",
"long"
],
"default":null
}
],
"connect.name":"io.debezium.connector.mongo.Source"
}
},
{
"name":"op",
"type":[
"null",
"string"
],
"default":null
},
{
"name":"ts_ms",
"type":[
"null",
"long"
],
"default":null
}
],
"connect.name":"mongodb.company.price_service_company_calc_logs.Envelope"
}