updated to support the new Settings implementation

Former-commit-id: bbb7dae7e2e9969ff648e9bfa0ddb4ab23cf3cc9
This commit is contained in:
Jeremy Long
2014-04-16 07:55:56 -04:00
parent a93c84ff64
commit 25fc2bfbea

View File

@@ -356,9 +356,8 @@ public class DependencyCheckMojo extends AbstractMojo implements MavenMultiPageR
LogUtils.prepareLogger(in, logFile); LogUtils.prepareLogger(in, logFile);
populateSettings(); populateSettings();
Engine engine = null; Engine engine = new Engine();
try {
engine = new Engine();
final Set<Artifact> artifacts = project.getArtifacts(); final Set<Artifact> artifacts = project.getArtifacts();
for (Artifact a : artifacts) { for (Artifact a : artifacts) {
if (skipTestScope && Artifact.SCOPE_TEST.equals(a.getScope())) { if (skipTestScope && Artifact.SCOPE_TEST.equals(a.getScope())) {
@@ -376,11 +375,7 @@ public class DependencyCheckMojo extends AbstractMojo implements MavenMultiPageR
engine.scan(a.getFile().getAbsolutePath()); engine.scan(a.getFile().getAbsolutePath());
} }
engine.analyzeDependencies(); engine.analyzeDependencies();
} finally {
if (engine != null) {
engine.cleanup();
}
}
return engine; return engine;
} }
@@ -815,6 +810,7 @@ public class DependencyCheckMojo extends AbstractMojo implements MavenMultiPageR
* properties required to change the proxy url, port, and connection timeout. * properties required to change the proxy url, port, and connection timeout.
*/ */
private void populateSettings() { private void populateSettings() {
Settings.initialize();
InputStream mojoProperties = null; InputStream mojoProperties = null;
try { try {
mojoProperties = this.getClass().getClassLoader().getResourceAsStream(PROPERTIES_FILE); mojoProperties = this.getClass().getClassLoader().getResourceAsStream(PROPERTIES_FILE);
@@ -951,6 +947,7 @@ public class DependencyCheckMojo extends AbstractMojo implements MavenMultiPageR
"Unable to connect to the dependency-check database; analysis has stopped"); "Unable to connect to the dependency-check database; analysis has stopped");
Logger.getLogger(DependencyCheckMojo.class.getName()).log(Level.FINE, "", ex); Logger.getLogger(DependencyCheckMojo.class.getName()).log(Level.FINE, "", ex);
} finally { } finally {
Settings.cleanup();
if (engine != null) { if (engine != null) {
engine.cleanup(); engine.cleanup();
} }
@@ -991,6 +988,7 @@ public class DependencyCheckMojo extends AbstractMojo implements MavenMultiPageR
"Unable to connect to the dependency-check database; analysis has stopped"); "Unable to connect to the dependency-check database; analysis has stopped");
Logger.getLogger(DependencyCheckMojo.class.getName()).log(Level.FINE, "", ex); Logger.getLogger(DependencyCheckMojo.class.getName()).log(Level.FINE, "", ex);
} finally { } finally {
Settings.cleanup();
if (engine != null) { if (engine != null) {
engine.cleanup(); engine.cleanup();
} }