12
12
13
13
import org .apache .maven .artifact .DependencyResolutionRequiredException ;
14
14
import org .apache .maven .plugin .AbstractMojo ;
15
+ import org .apache .maven .plugin .MojoFailureException ;
15
16
import org .apache .maven .plugins .annotations .Parameter ;
16
17
import org .apache .maven .project .MavenProject ;
17
- import org .apache .tools .ant .BuildException ;
18
18
import org .hibernate .cfg .reveng .OverrideRepository ;
19
19
import org .hibernate .cfg .reveng .ReverseEngineeringSettings ;
20
20
import org .hibernate .cfg .reveng .ReverseEngineeringStrategy ;
@@ -72,7 +72,7 @@ public abstract class AbstractHbm2xMojo extends AbstractMojo {
72
72
@ Parameter (defaultValue = "${project}" , readonly = true , required = true )
73
73
private MavenProject project ;
74
74
75
- public void execute () {
75
+ public void execute () throws MojoFailureException {
76
76
ClassLoader original = Thread .currentThread ().getContextClassLoader ();
77
77
try {
78
78
Thread .currentThread ().setContextClassLoader (createExporterClassLoader (original ));
@@ -89,12 +89,12 @@ public void execute() {
89
89
}
90
90
}
91
91
92
- private ReverseEngineeringStrategy setupReverseEngineeringStrategy () {
92
+ private ReverseEngineeringStrategy setupReverseEngineeringStrategy () throws MojoFailureException {
93
93
ReverseEngineeringStrategy strategy ;
94
94
try {
95
95
strategy = ReverseEngineeringStrategy .class .cast (Class .forName (revengStrategy ).newInstance ());
96
96
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException | ClassCastException e ) {
97
- throw new BuildException (revengStrategy + " not instanced." , e );
97
+ throw new MojoFailureException (revengStrategy + " not instanced." , e );
98
98
}
99
99
100
100
if (revengFile != null ) {
@@ -116,15 +116,15 @@ private ReverseEngineeringStrategy setupReverseEngineeringStrategy() {
116
116
return strategy ;
117
117
}
118
118
119
- private Properties loadPropertiesFile () {
119
+ private Properties loadPropertiesFile () throws MojoFailureException {
120
120
try (FileInputStream is = new FileInputStream (propertyFile )) {
121
121
Properties result = new Properties ();
122
122
result .load (is );
123
123
return result ;
124
124
} catch (FileNotFoundException e ) {
125
- throw new BuildException (propertyFile + " not found." , e );
125
+ throw new MojoFailureException (propertyFile + " not found." , e );
126
126
} catch (IOException e ) {
127
- throw new BuildException ("Problem while loading " + propertyFile , e );
127
+ throw new MojoFailureException ("Problem while loading " + propertyFile , e );
128
128
}
129
129
}
130
130
0 commit comments