Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ant/docs/examples/classpath/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
additional/classes
33 changes: 33 additions & 0 deletions ant/docs/examples/classpath/additional/src/HelloExporter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Hibernate Tools, Tooling for your Hibernate Projects
*
* Copyright 2004-2025 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import org.hibernate.tool.api.export.Exporter;

import java.util.Properties;

public class HelloExporter implements Exporter {

@Override
public Properties getProperties() {
return new Properties();
}

@Override
public void start() {
System.out.println("Hello from Exporter!");
}
}
60 changes: 60 additions & 0 deletions ant/docs/examples/classpath/build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<project xmlns:ivy="antlib:org.apache.ivy.ant">

<property name="hibernate-tools.version" value="7.0.0.CR1"/>
<property name="jdbc-driver.org" value="com.h2database"/>
<property name="jdbc-driver.module" value="h2"/>
<property name="jdbc-driver.version" value="2.3.232"/>

<ivy:cachepath
organisation="org.hibernate.tool"
module="hibernate-tools-ant"
revision="${hibernate-tools.version}"
pathid="hibernate-tools.path"
inline="true"/>
<ivy:cachepath
organisation="${jdbc-driver.org}"
module="${jdbc-driver.module}"
revision="${jdbc-driver.version}"
pathid="jdbc-driver.path"
inline="true"/>

<path id="classpath">
<path refid="hibernate-tools.path"/>
<path refid="jdbc-driver.path"/>
</path>

<taskdef
name="hibernatetool"
classname="org.hibernate.tool.ant.HibernateToolTask"
classpathref="classpath" />

<target name="clean">
<delete dir="additional/classes"/>
</target>

<target name="compile" depends="clean">
<!-- Create the target folder 'additional/classes' -->
<mkdir dir="additional/classes"/>
<!-- Compile the custom exporter 'HelloExporter' -->
<javac
srcdir="additional/src"
destdir="additional/classes"
classpathref="classpath"/>
</target>

<target name="reveng" depends="compile">
<hibernatetool destdir="generated-sources">
<!-- The classpath to be used by the 'hibernatetool' task
to look up additional classes or resources -->
<classpath>
<pathelement location="additional/classes"/>
</classpath>
<!-- Dummy configuration, as it is needed for any 'hibernatetool' task -->
<configuration />
<!-- Custom exporter of class 'HelloExporter' to be found on the specified classpath -->
<hbmtemplate exporterclass="HelloExporter"/>
</hibernatetool>
</target>

</project>