Skip to content

Commit 052c274

Browse files
authored
Improve documentation for templates code generation (#1544)
- fix gradle build setup - package info file is required Signed-off-by: Thomas Segismont <[email protected]>
1 parent ccfae94 commit 052c274

File tree

1 file changed

+22
-8
lines changed
  • vertx-sql-client-templates/src/main/asciidoc

1 file changed

+22
-8
lines changed

vertx-sql-client-templates/src/main/asciidoc/index.adoc

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -221,11 +221,10 @@ A Vert.x data object is a simple Java bean class annotated with the `@DataObject
221221
Any data object annotated by {@link io.vertx.sqlclient.templates.annotations.RowMapped} or {@link io.vertx.sqlclient.templates.annotations.ParametersMapped}
222222
will trigger the generation of a corresponding mapper class.
223223

224-
The _codegen_ annotation processor generates these classes at compilation time. It is a feature of the Java
225-
compiler so _no extra step_ is required, it is just a matter of configuring correctly your build:
224+
The _codegen_ annotation processor generates these classes at compilation time.
225+
It is a feature of the Java compiler so _no extra step_ is required, it is just a matter of configuring correctly your build.
226226

227-
Just add the `io.vertx:vertx-codegen:processor` and `io.vertx:${maven.artifactId}`
228-
dependencies to your build.
227+
Add the `io.vertx:vertx-codegen:processor` and `io.vertx:${maven.artifactId}` dependencies to your build.
229228

230229
Here a configuration example for Maven:
231230

@@ -249,16 +248,16 @@ This feature can also be used in Gradle:
249248
[source]
250249
----
251250
annotationProcessor "io.vertx:vertx-codegen:${maven.version}:processor"
251+
annotationProcessor "io.vertx:vertx-sql-client-templates:${maven.version}"
252252
compile "io.vertx:${maven.artifactId}:${maven.version}"
253+
compile "io.vertx:vertx-codegen-json:${maven.version}"
253254
----
254255

255256
IDEs usually provide support for annotation processors.
256257

257-
The codegen `processor` classifier adds to the jar the automatic configuration of the service proxy annotation processor
258-
via the `META-INF/services` plugin mechanism.
258+
The codegen `processor` classifier adds to the jar the automatic configuration of the service proxy annotation processor via the `META-INF/services` plugin mechanism.
259259

260-
If you want you can use it too with the regular jar, but you need then to declare the annotation processor
261-
explicitly, for instance in Maven:
260+
If you want you can use it too with the regular jar, but you need then to declare the annotation processor explicitly, for instance in Maven:
262261

263262
[source,xml]
264263
----
@@ -272,6 +271,21 @@ explicitly, for instance in Maven:
272271
</plugin>
273272
----
274273

274+
[IMPORTANT]
275+
====
276+
The codegen `processor` requires a `package-info.java` file annotated with `@io.vertx.codegen.annotations.ModuleGen` at the root of the package of the annotated classes.
277+
Here's an example:
278+
279+
[source,java]
280+
.`package-info.java` file
281+
----
282+
@ModuleGen(name = "templates", groupPackage = "org.acme")
283+
package org.acme.templates;
284+
285+
import io.vertx.codegen.annotations.ModuleGen;
286+
----
287+
====
288+
275289
=== Row mapping
276290

277291
You can generate a row mapper by annotating your data object by {@link io.vertx.sqlclient.templates.annotations.RowMapped}.

0 commit comments

Comments
 (0)