Skip to content

Installation

Kaumei JDBC supports Java 17 or newer. Your project also needs:

  • a JDBC driver for your database
  • annotation processing enabled in your build or IDE

Use the same Kaumei JDBC version for all artifacts.

ArtifactRoleWhere it belongs
io.kaumei.jdbc:jdbc-annotationAnnotations used in your source code.Compile time
io.kaumei.jdbc:jdbc-coreRuntime API used by generated code.Compile time and runtime
io.kaumei.jdbc:jdbc-processorAnnotation processor.Annotation processor path

The runtime classpath stays small. Generated code needs jdbc-core, jdbc-annotation, JSpecify annotations, and your JDBC driver. Processor-only dependencies such as JavaPoet stay on the annotation processor path and are not needed at runtime.

The Maven example below shows the required dependency roles.

For the latest published version see Maven Central Repository.

pom.xml
<properties>
<kaumei-jdbc.version>develop-SNAPSHOT</kaumei-jdbc.version>
</properties>
<dependencies>
<dependency>
<groupId>io.kaumei.jdbc</groupId>
<artifactId>jdbc-annotation</artifactId>
<version>${kaumei-jdbc.version}</version>
</dependency>
<dependency>
<groupId>io.kaumei.jdbc</groupId>
<artifactId>jdbc-core</artifactId>
<version>${kaumei-jdbc.version}</version>
</dependency>
</dependencies>

Configure the annotation processor path:

pom.xml
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>io.kaumei.jdbc</groupId>
<artifactId>jdbc-processor</artifactId>
<version>${kaumei-jdbc.version}</version>
</path>
</annotationProcessorPaths>
<compilerArgs>
<arg>-Aio.kaumei.jdbc.processor.config=io.kaumei.jdbc.spec.ConfigSpec</arg>
</compilerArgs>
</configuration>
</plugin>

Use the same dependency roles with other build tools:

  • add jdbc-annotation for compilation
  • add jdbc-core for compilation and runtime
  • add jdbc-processor to the annotation processor path

Do not put jdbc-processor on the application runtime classpath unless your build tool requires that internally.

When importing a project, make sure annotation processing is enabled.

Open Build, Execution, Deployment > Compiler > Annotation Processors and tick Enable annotation processing.