可用版本:Dev (3.21) | 最新版 (3.20) | 3.19 | 3.18 | 3.17 | 3.16 | 3.15 | 3.14 | 3.13 | 3.12

错误处理

适用于 ✅ 开源版   ✅ 专业版   ✅ 企业版

这个可选的顶层配置元素允许配置生成器在代码生成过程中遇到意外异常时采取的措施。

XML(独立和 Maven)
编程方式
Gradle (Kotlin)
Gradle (Groovy)
Gradle(第三方)
<configuration>

  <!-- Behaviour when encountering an exception. Defaults to FAIL -->
  <onError>FAIL</onError>

  <!-- Behaviour when encountering an unused configuration element. Defaults to LOG -->
  <onUnused>LOG</onUnused>
</configuration>

有关更多详细信息,请参阅配置 XSD独立代码生成Maven 代码生成

new org.jooq.meta.jaxb.Configuration()

  // Behaviour when encountering an exception. Defaults to FAIL
  .withOnError(OnError.FAIL)

  // Behaviour when encountering an unused configuration element. Defaults to LOG
  .withOnUnused(OnError.LOG)

有关更多详细信息,请参阅配置 XSD程序化代码生成

import org.jooq.meta.jaxb.*


configuration {

  // Behaviour when encountering an exception. Defaults to FAIL
  onError = OnError.FAIL

  // Behaviour when encountering an unused configuration element. Defaults to LOG
  onUnused = OnError.LOG
}

有关更多详细信息,请参阅配置 XSDGradle 代码生成

configuration {

  // Behaviour when encountering an exception. Defaults to FAIL
  onError = "FAIL"

  // Behaviour when encountering an unused configuration element. Defaults to LOG
  onUnused = "LOG"
}

有关更多详细信息,请参阅配置 XSDGradle 代码生成

// The jOOQ-codegen-gradle plugin has been introduced in version 3.19.
// Please use the official plugin instead of the third party plugin that was recommended before.

可用的错误操作有

  • FAIL - 异常将被抛出并由调用者(例如 Maven)处理
  • LOG - 异常将由生成器通过将其记录为警告来处理
  • SILENT - 异常将被生成器静默忽略

反馈

您对此页面有任何反馈吗? 我们很乐意听到您的反馈!

The jOOQ Logo