Skip to content

Commit efe03cb

Browse files
committed
Fixe method execution order
1 parent b44e904 commit efe03cb

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,12 @@ public void execute() throws MojoExecutionException {
139139
Version utlVersion = new DefaultDatabaseInformation().getUtPlsqlFrameworkVersion(connection);
140140
getLog().info("utPLSQL Version = " + utlVersion);
141141

142-
reportWriter = new ReportWriter(targetDir, utlVersion, getLog());
143-
144-
List<Reporter> reporterList = initReporters(connection, reportWriter, ReporterFactory.createEmpty());
145142
FileMapperOptions sourceMappingOptions = buildSourcesOptions();
146143
FileMapperOptions testMappingOptions = buildTestsOptions();
147144

145+
reportWriter = new ReportWriter(targetDir, utlVersion, getLog());
146+
List<Reporter> reporterList = initReporters(connection, reportWriter, ReporterFactory.createEmpty());
147+
148148
logParameters(sourceMappingOptions, testMappingOptions, reporterList);
149149

150150
TestRunner runner = new TestRunner()
@@ -172,7 +172,7 @@ public void execute() throws MojoExecutionException {
172172
if (!ignoreFailure) {
173173
throw new MojoExecutionException(e.getMessage(), e);
174174
}
175-
} catch (SQLException e) {
175+
} catch (SQLException | IOException e) {
176176
throw new MojoExecutionException(e.getMessage(), e);
177177
} finally {
178178
try {
@@ -215,7 +215,7 @@ private Connection createConnection() throws SQLException {
215215
return connection;
216216
}
217217

218-
FileMapperOptions buildSourcesOptions() throws MojoExecutionException {
218+
FileMapperOptions buildSourcesOptions() throws IOException {
219219
if (sources.isEmpty()) {
220220
File defaultSourceDirectory = new File(project.getBasedir(), Defaults.SOURCE_DIRECTORY);
221221
if (defaultSourceDirectory.exists()) {
@@ -231,7 +231,7 @@ FileMapperOptions buildSourcesOptions() throws MojoExecutionException {
231231
sourcesNameSubexpression, sourcesTypeSubexpression, sourcesCustomTypeMapping);
232232
}
233233

234-
FileMapperOptions buildTestsOptions() throws MojoExecutionException {
234+
FileMapperOptions buildTestsOptions() throws IOException {
235235
if (tests.isEmpty()) {
236236
File defaultTestDirectory = new File(project.getBasedir(), Defaults.TEST_DIRECTORY);
237237
if (defaultTestDirectory.exists()) {

src/main/java/org/utplsql/maven/plugin/io/SqlFileScanner.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package org.utplsql.maven.plugin.io;
22

33
import org.apache.maven.model.Resource;
4-
import org.apache.maven.plugin.MojoExecutionException;
54
import org.codehaus.plexus.util.DirectoryScanner;
65

76
import java.io.File;
7+
import java.io.IOException;
88
import java.util.ArrayList;
99
import java.util.Collections;
1010
import java.util.List;
@@ -28,7 +28,7 @@ public class SqlFileScanner {
2828
* @param defaultFilePattern the default file pattern
2929
* @return a list of the files found
3030
*/
31-
public List<String> findSqlScripts(File baseDir, List<Resource> resources, String defaultDirectory, String defaultFilePattern) throws MojoExecutionException {
31+
public List<String> findSqlScripts(File baseDir, List<Resource> resources, String defaultDirectory, String defaultFilePattern) throws IOException {
3232
List<String> founds = new ArrayList<>();
3333

3434
for (Resource resource : resources) {
@@ -52,10 +52,10 @@ public List<String> findSqlScripts(File baseDir, List<Resource> resources, Strin
5252
return founds;
5353
}
5454

55-
private DirectoryScanner buildScanner(String baseDir, Resource resource) throws MojoExecutionException {
55+
private DirectoryScanner buildScanner(String baseDir, Resource resource) throws IOException {
5656
File fileBaseDir = new File(baseDir, resource.getDirectory());
5757
if (!fileBaseDir.exists() || !fileBaseDir.isDirectory() || !fileBaseDir.canRead()) {
58-
throw new MojoExecutionException(format("Directory %s does not exist!", resource.getDirectory()));
58+
throw new IOException(format("Directory %s does not exist!", resource.getDirectory()));
5959
}
6060

6161
DirectoryScanner scanner = new DirectoryScanner();

0 commit comments

Comments
 (0)