Skip to content

Commit a4d4f06

Browse files
committed
HBX-3050: Add a functional tests for the Maven generateJava mojo guarding the sanity of the 5 minute tutorial
- Change the used property '@project.version@' into @hibernate.version@ and add the property to 'maven/pom.xml' - Change the delimiters for the filtering of the 'h2.version' and 'hibernate.version' properties in '5-minute-tutorial/pom.xml' - Add a 'README.md' to the '5-minute-tutorial' example, describing how to run it Signed-off-by: Koen Aers <[email protected]>
1 parent 881989a commit a4d4f06

File tree

3 files changed

+30
-4
lines changed

3 files changed

+30
-4
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!--
2+
~ Copyright 2004 - 2025 Red Hat, Inc.
3+
~
4+
~ Licensed under the Apache License, Version 2.0 (the "License");
5+
~ you may not use this file except in compliance with the License.
6+
~ You may obtain a copy of the License at
7+
~
8+
~ http://www.apache.org/licenses/LICENSE-2.0
9+
~
10+
~ Unless required by applicable law or agreed to in writing, software
11+
~ distributed under the License is distributed on an "AS IS" basis,
12+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
~ See the License for the specific language governing permissions and
14+
~ limitations under the License.
15+
-->
16+
To run this example:
17+
- Have [Apache Maven](https://maven.apache.org) installed
18+
- Have [H2 Sakila database](https://github.com/hibernate/sakila-h2) running
19+
- Issue one of the following commands from a command-line window opened in this folder:
20+
- `mvn generate-sources -Dh2.version=${h2.version} -Dproject.version=${hibernate.version}`
21+
- `mvn hbm2java -Dh2.version=${h2.version} -Dproject.version=${hibernate.version}`
22+

maven/docs/examples/5-minute-tutorial/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<dependency>
2828
<groupId>com.h2database</groupId>
2929
<artifactId>h2</artifactId>
30-
<version>@h2.version@</version>
30+
<version>${h2.version}</version>
3131
</dependency>
3232
</dependencies>
3333

@@ -36,7 +36,7 @@
3636
<plugin>
3737
<groupId>org.hibernate.tool</groupId>
3838
<artifactId>hibernate-tools-maven</artifactId>
39-
<version>@project.version@</version>
39+
<version>${hibernate.version}</version>
4040
<executions>
4141
<execution>
4242
<id>Entity generation</id>

maven/pom.xml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
<!-- This is a publicly distributed module that should be published: -->
3535
<deploy.skip>false</deploy.skip>
3636
<maven.install.skip>false</maven.install.skip>
37+
<!-- To run the integration tests we need to set ${hibernate.version} -->
38+
<hibernate.version>${project.version}</hibernate.version>
3739
</properties>
3840

3941
<dependencies>
@@ -149,6 +151,8 @@
149151
</execution>
150152
</executions>
151153
</plugin>
154+
<!-- The Invoker plugin will populate the local Maven repository with the artefacts
155+
needed to run the integration tests with the FailSafe plugin -->
152156
<plugin>
153157
<artifactId>maven-invoker-plugin</artifactId>
154158
<version>${maven-invoker-plugin.version}</version>
@@ -164,7 +168,7 @@
164168
</execution>
165169
</executions>
166170
</plugin>
167-
<!-- run the integration tests -->
171+
<!-- Run the integration tests -->
168172
<plugin>
169173
<groupId>org.apache.maven.plugins</groupId>
170174
<artifactId>maven-failsafe-plugin</artifactId>
@@ -235,7 +239,7 @@
235239
</resource>
236240
</resources>
237241
<delimiters>
238-
<delimiter>@*@</delimiter>
242+
<delimiter>${*}</delimiter>
239243
</delimiters>
240244
</configuration>
241245
</execution>

0 commit comments

Comments
 (0)