diff --git a/src/IKVM.Maven.Sdk.Tasks/MavenEnvironment.cs b/src/IKVM.Maven.Sdk.Tasks/MavenEnvironment.cs index 3bcf0e6..7be4927 100644 --- a/src/IKVM.Maven.Sdk.Tasks/MavenEnvironment.cs +++ b/src/IKVM.Maven.Sdk.Tasks/MavenEnvironment.cs @@ -164,16 +164,20 @@ Settings ReadSettings() var settings = settingsResult.getEffectiveSettings(); // use settings-security.xml to decrypt loaded settings - var secDispatcher = new SecDispatcher(Path.Combine(userHome, SettingsSecurityXml)); - var secDecrypter = new DefaultSettingsDecrypter(secDispatcher); - var secResult = secDecrypter.decrypt(new DefaultSettingsDecryptionRequest(settings)); - if (secResult.getProblems() is List secProblems) - foreach (var i in secProblems.AsEnumerable()) - HandleSettingsProblem(i); - - // apply decrypted settings - settings.setServers(secResult.getServers()); - settings.setProxies(secResult.getProxies()); + var securityFile = Path.Combine(userHome, SettingsSecurityXml); + if (System.IO.File.Exists(securityFile)) + { + var secDispatcher = new SecDispatcher(securityFile); + var secDecrypter = new DefaultSettingsDecrypter(secDispatcher); + var secResult = secDecrypter.decrypt(new DefaultSettingsDecryptionRequest(settings)); + if (secResult.getProblems() is List secProblems) + foreach (var i in secProblems.AsEnumerable()) + HandleSettingsProblem(i); + + // apply decrypted settings + settings.setServers(secResult.getServers()); + settings.setProxies(secResult.getProxies()); + } return settings; }