Skip to content

Commit a34f4dd

Browse files
committed
HBX-3146: Remove the use of Ant BuildException from the Maven mojos
Signed-off-by: Koen Aers <[email protected]>
1 parent f5f8327 commit a34f4dd

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

maven/src/main/java/org/hibernate/tool/maven/AbstractGenerationMojo.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,13 @@
2727
import java.net.URL;
2828
import java.net.URLClassLoader;
2929
import java.util.ArrayList;
30-
import java.util.Arrays;
31-
import java.util.HashSet;
3230
import java.util.Properties;
3331

3432
import org.apache.maven.artifact.DependencyResolutionRequiredException;
3533
import org.apache.maven.plugin.AbstractMojo;
34+
import org.apache.maven.plugin.MojoFailureException;
3635
import org.apache.maven.plugins.annotations.Parameter;
3736
import org.apache.maven.project.MavenProject;
38-
import org.apache.tools.ant.BuildException;
3937
import org.hibernate.tool.api.metadata.MetadataDescriptor;
4038
import org.hibernate.tool.api.metadata.MetadataDescriptorFactory;
4139
import org.hibernate.tool.api.metadata.MetadataConstants;
@@ -94,7 +92,7 @@ public abstract class AbstractGenerationMojo extends AbstractMojo {
9492
@Parameter(defaultValue = "${project}", readonly = true, required = true)
9593
private MavenProject project;
9694

97-
public void execute() {
95+
public void execute() throws MojoFailureException {
9896
ClassLoader original = Thread.currentThread().getContextClassLoader();
9997
try {
10098
Thread.currentThread().setContextClassLoader(createExporterClassLoader(original));
@@ -132,15 +130,15 @@ private RevengStrategy setupReverseEngineeringStrategy() {
132130
return strategy;
133131
}
134132

135-
private Properties loadPropertiesFile() {
133+
private Properties loadPropertiesFile() throws MojoFailureException {
136134
try (FileInputStream is = new FileInputStream(propertyFile)) {
137135
Properties result = new Properties();
138136
result.load(is);
139137
return result;
140138
} catch (FileNotFoundException e) {
141-
throw new BuildException(propertyFile + " not found.", e);
139+
throw new MojoFailureException(propertyFile + " not found.", e);
142140
} catch (IOException e) {
143-
throw new BuildException("Problem while loading " + propertyFile, e);
141+
throw new MojoFailureException("Problem while loading " + propertyFile, e);
144142
}
145143
}
146144

0 commit comments

Comments
 (0)