Skip to content

Commit 258513b

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

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

maven-plugin/src/main/java/org/hibernate/mvn/AbstractHbm2xMojo.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212

1313
import org.apache.maven.artifact.DependencyResolutionRequiredException;
1414
import org.apache.maven.plugin.AbstractMojo;
15+
import org.apache.maven.plugin.MojoFailureException;
1516
import org.apache.maven.plugins.annotations.Parameter;
1617
import org.apache.maven.project.MavenProject;
17-
import org.apache.tools.ant.BuildException;
1818
import org.hibernate.cfg.reveng.OverrideRepository;
1919
import org.hibernate.cfg.reveng.ReverseEngineeringSettings;
2020
import org.hibernate.cfg.reveng.ReverseEngineeringStrategy;
@@ -72,7 +72,7 @@ public abstract class AbstractHbm2xMojo extends AbstractMojo {
7272
@Parameter(defaultValue = "${project}", readonly = true, required = true)
7373
private MavenProject project;
7474

75-
public void execute() {
75+
public void execute() throws MojoFailureException {
7676
ClassLoader original = Thread.currentThread().getContextClassLoader();
7777
try {
7878
Thread.currentThread().setContextClassLoader(createExporterClassLoader(original));
@@ -89,12 +89,12 @@ public void execute() {
8989
}
9090
}
9191

92-
private ReverseEngineeringStrategy setupReverseEngineeringStrategy() {
92+
private ReverseEngineeringStrategy setupReverseEngineeringStrategy() throws MojoFailureException {
9393
ReverseEngineeringStrategy strategy;
9494
try {
9595
strategy = ReverseEngineeringStrategy.class.cast(Class.forName(revengStrategy).newInstance());
9696
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException | ClassCastException e) {
97-
throw new BuildException(revengStrategy + " not instanced.", e);
97+
throw new MojoFailureException(revengStrategy + " not instanced.", e);
9898
}
9999

100100
if (revengFile != null) {
@@ -116,15 +116,15 @@ private ReverseEngineeringStrategy setupReverseEngineeringStrategy() {
116116
return strategy;
117117
}
118118

119-
private Properties loadPropertiesFile() {
119+
private Properties loadPropertiesFile() throws MojoFailureException {
120120
try (FileInputStream is = new FileInputStream(propertyFile)) {
121121
Properties result = new Properties();
122122
result.load(is);
123123
return result;
124124
} catch (FileNotFoundException e) {
125-
throw new BuildException(propertyFile + " not found.", e);
125+
throw new MojoFailureException(propertyFile + " not found.", e);
126126
} catch (IOException e) {
127-
throw new BuildException("Problem while loading " + propertyFile, e);
127+
throw new MojoFailureException("Problem while loading " + propertyFile, e);
128128
}
129129
}
130130

0 commit comments

Comments
 (0)