Skip to content

Commit 9183c3b

Browse files
koentsjeyrodiere
authored andcommitted
HHH-19815: Review and Complete the documentation of the Enhance Plugin in the User's Guide
Signed-off-by: Koen Aers <[email protected]>
1 parent a3afc1e commit 9183c3b

File tree

2 files changed

+141
-9
lines changed

2 files changed

+141
-9
lines changed

documentation/src/main/asciidoc/userguide/chapters/tooling/extras/maven-example.pom

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,11 @@
22
<plugins>
33
[...]
44
<plugin>
5-
<groupId>org.hibernate.orm.tooling</groupId>
6-
<artifactId>hibernate-enhance-maven-plugin</artifactId>
5+
<groupId>org.hibernate.orm</groupId>
6+
<artifactId>hibernate-maven-plugin</artifactId>
77
<version>$currentHibernateVersion</version>
88
<executions>
99
<execution>
10-
<configuration>
11-
<failOnError>true</failOnError>
12-
<enableLazyInitialization>true</enableLazyInitialization>
13-
<enableDirtyTracking>true</enableDirtyTracking>
14-
<enableAssociationManagement>true</enableAssociationManagement>
15-
</configuration>
1610
<goals>
1711
<goal>enhance</goal>
1812
</goals>

documentation/src/main/asciidoc/userguide/chapters/tooling/maven.adoc

Lines changed: 139 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,14 @@ The following sections illustrate how both <<tooling-maven-enhancement,bytecode
99
Hibernate provides a https://maven.apache.org/[Maven] plugin capable of providing
1010
build-time enhancement of the domain model as they are compiled as part of a Maven
1111
build. See the section on <<BytecodeEnhancement>> for details
12-
on the configuration settings. By default, all enhancements are disabled.
12+
on the configuration settings.
1313

14+
[[maven-enhance-goal]]
15+
===== *Enhance Goal* =====
16+
17+
An example of using the `enhance` goal of the plugin is shown below. By default the plugin will
18+
perform bytecode enhancement for lazy initialization and dirty tracking. See <<maven-enhance-configuration, below>>
19+
for more details on the available parameters.
1420

1521
.Apply the Bytecode Enhancement plugin
1622
====
@@ -20,6 +26,138 @@ include::extras/maven-example.pom[]
2026
----
2127
====
2228

29+
[[maven-enhance-configuration]]
30+
===== *Enhance Configuration* =====
31+
32+
[[maven-enhance-classesDirectory-parameter]]
33+
====== `*classesDirectory*` ======
34+
This parameter points to the folder in which to look for classes to enhance.
35+
It defaults to the value of `{project.build.directory}/classes` and thus in most cases to `target/classes`.
36+
If both `classesDirectory` and <<maven-enhance-filesets-parameter,fileSets>> are set,
37+
`fileSets` takes precedence.
38+
39+
====
40+
[source,xml]
41+
----
42+
[...]
43+
<execution>
44+
<configuration>
45+
<classesDirectory>path-to-some-folder</classesDirectory>
46+
</configuration>
47+
[...]
48+
</execution>
49+
[...]
50+
----
51+
====
52+
53+
[[maven-enhance-filesets-parameter]]
54+
====== `*fileSets*` ======
55+
This optional parameter comes in handy when you need to filter the classes that you want to enhance.
56+
More information on how to use filesets is to be found on the
57+
https://maven.apache.org/shared/file-management/fileset.html[fileset documentation page].
58+
If both <<maven-enhance-classesDirectory-parameter, classesDirectory>> and `fileSets` are set,
59+
`fileSets` takes precedence.
60+
61+
====
62+
[source,xml]
63+
----
64+
[...]
65+
<execution>
66+
<configuration>
67+
<fileSets>
68+
<fileset dir="path-to-some-folder">
69+
<exclude name='Baz.class' />
70+
</fileset>
71+
</fileSets>
72+
</configuration>
73+
[...]
74+
</execution>
75+
[...]
76+
----
77+
====
78+
79+
[[maven-enhance-enableLazyInitialization-parameter]]
80+
===== `*enableLazyInitialization*` =====
81+
This parameter has a default value of `true`. It indicates whether the enhance goal should perform the changes
82+
to enable <<BytecodeEnhancement-lazy-loading,lazy loading>>.
83+
The parameter has been deprecated for removal. After this removal, <<BytecodeEnhancement-lazy-loading,lazy loading>>
84+
will always be enabled.
85+
86+
====
87+
[source,xml]
88+
----
89+
[...]
90+
<execution>
91+
<configuration>
92+
<enableLazyInitialization>false</enableLazyInitialization>
93+
</configuration>
94+
[...]
95+
</execution>
96+
[...]
97+
----
98+
====
99+
100+
[[maven-enhance-enableDirtyTracking-parameter]]
101+
===== `*enableDirtyTracking*` =====
102+
This parameter has a default value of `true`. It indicates whether the enhance task should perform the changes
103+
to enable <<BytecodeEnhancement-dirty-tracking,dirty tracking>>.
104+
The parameter has been deprecated for removal. After this removal, <<BytecodeEnhancement-dirty-tracking,dirty tracking>>
105+
will always be enabled.
106+
107+
====
108+
[source,xml]
109+
----
110+
[...]
111+
<execution>
112+
<configuration>
113+
<enableDirtyTracking>false</enableDirtyTracking>
114+
</configuration>
115+
[...]
116+
</execution>
117+
[...]
118+
----
119+
====
120+
121+
[[maven-enhance-enableAssociationManagement-parameter]]
122+
===== `*enableAssociationManagement*` =====
123+
This parameter has a default value of `false`. It indicates whether the enhance task should perform the changes
124+
to enable <<BytecodeEnhancement-dirty-tracking-bidirectional,association management>>.
125+
126+
====
127+
[source,xml]
128+
----
129+
[...]
130+
<execution>
131+
<configuration>
132+
<enableAssociationManagement>true</enableAssociationManagement>
133+
</configuration>
134+
[...]
135+
</execution>
136+
[...]
137+
----
138+
====
139+
140+
[[maven-enhance-enableExtendedEnhancement-paremeter]]
141+
===== `*enableExtendedEnhancement*` =====
142+
This parameter has a default value of `false`. It indicates whether the enhance task should perform the changes
143+
to enable the extended enhancement: enhancement of non-entities to trigger lazy-loading and inline dirty tracking
144+
even when accessing entity fields directly..
145+
146+
====
147+
[source,xml]
148+
----
149+
[...]
150+
<execution>
151+
<configuration>
152+
<enableExtendedEnhancement>true</enableExtendedEnhancement>
153+
</configuration>
154+
[...]
155+
</execution>
156+
[...]
157+
----
158+
====
159+
160+
23161
[[tooling-maven-modelgen]]
24162
==== Static Metamodel Generation
25163

0 commit comments

Comments
 (0)