Skip to content

Commit 54777d6

Browse files
committed
HBX-2984: Create Reference Guide for Ant
- Create file 'ant/docs/examples/common/included.xml' with the common ant tasks for the examples - Use the file above in 'ant/docs/examples/5-minute-tutorial/build.xml' - Use the file above in 'ant/docs/examples/classpath/build.xml' Signed-off-by: Koen Aers <[email protected]>
1 parent 5f1c2e7 commit 54777d6

File tree

5 files changed

+64
-60
lines changed

5 files changed

+64
-60
lines changed

ant/docs/examples/5-minute-tutorial/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
To run this example:
1717
- Have [Apache Ant](https://ant.apache.org) installed
1818
- Have [H2 Sakila database](https://github.com/koentsje/sakila-h2) running
19-
- Issue `ant reveng` from a command-line window
19+
- Issue `ant` from a command-line window

ant/docs/examples/5-minute-tutorial/build.xml

Lines changed: 11 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,39 +13,22 @@
1313
~ See the License for the specific language governing permissions and
1414
~ limitations under the License.
1515
-->
16-
<project xmlns:ivy="antlib:org.apache.ivy.ant">
16+
<project name="5-minute-tutorial" default="reveng">
1717

18-
<property name="hibernate-tools.version" value="7.0.0.CR1"/>
19-
<property name="jdbc-driver.org" value="com.h2database"/>
20-
<property name="jdbc-driver.module" value="h2"/>
21-
<property name="jdbc-driver.version" value="2.3.232"/>
18+
<!-- Include the 'hibernatetool' task definition from the file '../common/included.xml' -->
19+
<include file="../common/included.xml"/>
2220

23-
<ivy:cachepath
24-
organisation="org.hibernate.tool"
25-
module="hibernate-tools-ant"
26-
revision="${hibernate-tools.version}"
27-
pathid="hibernate-tools.path"
28-
inline="true"/>
29-
<ivy:cachepath
30-
organisation="${jdbc-driver.org}"
31-
module="${jdbc-driver.module}"
32-
revision="${jdbc-driver.version}"
33-
pathid="jdbc-driver.path"
34-
inline="true"/>
35-
36-
<path id="classpath">
37-
<path refid="hibernate-tools.path"/>
38-
<path refid="jdbc-driver.path"/>
39-
</path>
40-
41-
<taskdef
42-
name="hibernatetool"
43-
classname="org.hibernate.tool.ant.HibernateToolTask"
44-
classpathref="classpath" />
21+
<target name="clean">
22+
<!-- Delete the folder 'generated-sources' if it exists -->
23+
<delete dir="generated-sources"/>
24+
</target>
4525

46-
<target name="reveng">
26+
<target name="reveng" depends="clean">
27+
<!-- Generation of the artefacts in folder 'generated-sources' -->
4728
<hibernatetool destdir="generated-sources">
29+
<!-- JDBC Configuration with properties in file 'hibernate.properties' -->
4830
<jdbcconfiguration propertyfile="hibernate.properties" />
31+
<!-- The Java file exporter -->
4932
<hbm2java/>
5033
</hibernatetool>
5134
</target>

ant/docs/examples/classpath/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
-->
1616
To run this example:
1717
- Have [Apache Ant](https://ant.apache.org) installed
18-
- Issue `ant reveng` from a command-line window
18+
- Issue `ant` from a command-line window

ant/docs/examples/classpath/build.xml

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,37 +13,13 @@
1313
~ See the License for the specific language governing permissions and
1414
~ limitations under the License.
1515
-->
16-
<project xmlns:ivy="antlib:org.apache.ivy.ant">
16+
<project name="classpath" default="reveng">
1717

18-
<property name="hibernate-tools.version" value="7.0.0.CR1"/>
19-
<property name="jdbc-driver.org" value="com.h2database"/>
20-
<property name="jdbc-driver.module" value="h2"/>
21-
<property name="jdbc-driver.version" value="2.3.232"/>
22-
23-
<ivy:cachepath
24-
organisation="org.hibernate.tool"
25-
module="hibernate-tools-ant"
26-
revision="${hibernate-tools.version}"
27-
pathid="hibernate-tools.path"
28-
inline="true"/>
29-
<ivy:cachepath
30-
organisation="${jdbc-driver.org}"
31-
module="${jdbc-driver.module}"
32-
revision="${jdbc-driver.version}"
33-
pathid="jdbc-driver.path"
34-
inline="true"/>
35-
36-
<path id="classpath">
37-
<path refid="hibernate-tools.path"/>
38-
<path refid="jdbc-driver.path"/>
39-
</path>
40-
41-
<taskdef
42-
name="hibernatetool"
43-
classname="org.hibernate.tool.ant.HibernateToolTask"
44-
classpathref="classpath" />
18+
<!-- Include the 'hibernatetool' task definition from the file '../common/included.xml' -->
19+
<include file="../common/included.xml"/>
4520

4621
<target name="clean">
22+
<!-- Delete the folder 'additional/classes if it exists -->
4723
<delete dir="additional/classes"/>
4824
</target>
4925

@@ -59,8 +35,7 @@
5935

6036
<target name="reveng" depends="compile">
6137
<hibernatetool destdir="generated-sources">
62-
<!-- The classpath to be used by the 'hibernatetool' task
63-
to look up additional classes or resources -->
38+
<!-- The classpath to be used by the 'hibernatetool' task to look up additional classes or resources -->
6439
<classpath>
6540
<pathelement location="additional/classes"/>
6641
</classpath>
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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+
<project name="common" xmlns:ivy="antlib:org.apache.ivy.ant">
17+
18+
<property name="hibernate-tools.version" value="7.0.0.CR1"/>
19+
<property name="jdbc-driver.org" value="com.h2database"/>
20+
<property name="jdbc-driver.module" value="h2"/>
21+
<property name="jdbc-driver.version" value="2.3.232"/>
22+
23+
<ivy:cachepath
24+
organisation="org.hibernate.tool"
25+
module="hibernate-tools-ant"
26+
revision="${hibernate-tools.version}"
27+
pathid="hibernate-tools.path"
28+
inline="true"/>
29+
<ivy:cachepath
30+
organisation="${jdbc-driver.org}"
31+
module="${jdbc-driver.module}"
32+
revision="${jdbc-driver.version}"
33+
pathid="jdbc-driver.path"
34+
inline="true"/>
35+
36+
<path id="classpath">
37+
<path refid="hibernate-tools.path"/>
38+
<path refid="jdbc-driver.path"/>
39+
</path>
40+
41+
<taskdef
42+
name="hibernatetool"
43+
classname="org.hibernate.tool.ant.HibernateToolTask"
44+
classpathref="classpath" />
45+
46+
</project>

0 commit comments

Comments
 (0)