Skip to content

Commit e17ad15

Browse files
committed
Improve documentation for templates code generation
- fix gradle build setup - package info file is required Signed-off-by: Thomas Segismont <[email protected]>
1 parent ccfae94 commit e17ad15

File tree

1 file changed

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

1 file changed

+19
-8
lines changed

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

Lines changed: 19 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,28 @@ 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}"
254+
----
255+
256+
The Vert.x codegen process requires a `package-info.java` file annotated with `@io.vertx.codegen.annotations.ModuleGen` at the root of the package of the annotated classes.
257+
Here's an example:
258+
259+
[source,java]
260+
.`package-info.java` file
261+
----
262+
@ModuleGen(name = "templates", groupPackage = "org.acme")
263+
package org.acme.templates;
264+
265+
import io.vertx.codegen.annotations.ModuleGen;
253266
----
254267

255268
IDEs usually provide support for annotation processors.
256269

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.
270+
The codegen `processor` classifier adds to the jar the automatic configuration of the service proxy annotation processor via the `META-INF/services` plugin mechanism.
259271

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:
272+
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:
262273

263274
[source,xml]
264275
----

0 commit comments

Comments
 (0)