public ConfigureSettingsFromFileTask(final String pathToSettingsXmlFile) throws InvalidConfigurationFileException { assert pathToSettingsXmlFile != null && pathToSettingsXmlFile.length() > 0; String resolvedPath = null; try { resolvedPath = pathToSettingsXmlFile; Validate.isReadable(resolvedPath, "Path to the settings.xml ('" + pathToSettingsXmlFile + "') must be defined and accessible"); } // rewrap exception catch (IllegalArgumentException e) { throw new InvalidConfigurationFileException(e.getMessage()); } this.settingsXmlFile = new File(resolvedPath); }
public ConfigureSettingsFromFileTask(final String pathToSettingsXmlFile) throws InvalidConfigurationFileException { assert pathToSettingsXmlFile != null && pathToSettingsXmlFile.length() > 0; String resolvedPath = null; try { resolvedPath = pathToSettingsXmlFile; Validate.isReadable(resolvedPath, "Path to the settings.xml ('" + pathToSettingsXmlFile + "') must be defined and accessible"); } // rewrap exception catch (IllegalArgumentException e) { throw new InvalidConfigurationFileException(e.getMessage()); } this.settingsXmlFile = new File(resolvedPath); }
@Override public MavenWorkingSession execute(final MavenWorkingSession session) { try { Validate.isReadable(settingsXmlFile, "Path to the settings.xml ('" + settingsXmlFile + "') must be defined and accessible"); } // rewrap exception catch (IllegalArgumentException e) { throw new InvalidConfigurationFileException(e.getMessage()); } return session.configureSettingsFromFile(null, settingsXmlFile); }
@Override public MavenWorkingSession execute(final MavenWorkingSession session) { try { Validate.isReadable(settingsXmlFile, "Path to the settings.xml ('" + settingsXmlFile + "') must be defined and accessible"); } // rewrap exception catch (IllegalArgumentException e) { throw new InvalidConfigurationFileException(e.getMessage()); } return session.configureSettingsFromFile(null, settingsXmlFile); }
private String getMaster() throws SecDispatcherException, InvalidConfigurationFileException { if (securitySettings == null) { throw new InvalidConfigurationFileException( "Unable to get security configuration from " + securitySettingsPath.getPath() + ". Please define path to the settings-security.xml file via -D" + MavenSettingsBuilder.ALT_SECURITY_SETTINGS_XML_LOCATION + ", or put it the the default location defined by Maven."); } String master = securitySettings.getMaster(); if (master == null) { throw new InvalidConfigurationFileException("Security configuration from " + securitySettingsPath.getPath() + " does not contain master password"); } try { return cipher.decryptDecorated(master, DEFAULT_PASSPHRASE); } catch (PlexusCipherException e) { throw new SecDispatcherException(e); } } }
private String getMaster() throws SecDispatcherException, InvalidConfigurationFileException { if (securitySettings == null) { throw new InvalidConfigurationFileException( "Unable to get security configuration from " + securitySettingsPath.getPath() + ". Please define path to the settings-security.xml file via -D" + MavenSettingsBuilder.ALT_SECURITY_SETTINGS_XML_LOCATION + ", or put it the the default location defined by Maven."); } String master = securitySettings.getMaster(); if (master == null) { throw new InvalidConfigurationFileException("Security configuration from " + securitySettingsPath.getPath() + " does not contain master password"); } try { return cipher.decryptDecorated(master, DEFAULT_PASSPHRASE); } catch (PlexusCipherException e) { throw new SecDispatcherException(e); } } }
private Settings decryptPasswords(Settings settings) { File securitySettings = new File(DEFAULT_SETTINGS_SECURITY_PATH); String altSecuritySettings = SecurityActions.getProperty(ALT_SECURITY_SETTINGS_XML_LOCATION); // set alternate file if (altSecuritySettings != null && altSecuritySettings.length() > 0) { securitySettings = new File(altSecuritySettings); } SettingsDecrypter decrypter = new MavenSettingsDecrypter(securitySettings); SettingsDecryptionRequest request = new DefaultSettingsDecryptionRequest(settings); SettingsDecryptionResult result = decrypter.decrypt(request); if (result.getProblems().size() > 0) { StringBuilder sb = new StringBuilder("Found ").append(result.getProblems().size()) .append(" problems while trying to decrypt settings configuration."); int counter = 1; for (SettingsProblem problem : result.getProblems()) { sb.append(counter++).append("/ ").append(problem).append("\n"); } throw new InvalidConfigurationFileException(sb.toString()); } settings.setProxies(result.getProxies()); settings.setServers(result.getServers()); return settings; }
private Settings decryptPasswords(Settings settings) { File securitySettings = new File(DEFAULT_SETTINGS_SECURITY_PATH); String altSecuritySettings = SecurityActions.getProperty(ALT_SECURITY_SETTINGS_XML_LOCATION); // set alternate file if (altSecuritySettings != null && altSecuritySettings.length() > 0) { securitySettings = new File(altSecuritySettings); } SettingsDecrypter decrypter = new MavenSettingsDecrypter(securitySettings); SettingsDecryptionRequest request = new DefaultSettingsDecryptionRequest(settings); SettingsDecryptionResult result = decrypter.decrypt(request); if (result.getProblems().size() > 0) { StringBuilder sb = new StringBuilder("Found ").append(result.getProblems().size()) .append(" problems while trying to decrypt settings configuration."); int counter = 1; for (SettingsProblem problem : result.getProblems()) { sb.append(counter++).append("/ ").append(problem).append("\n"); } throw new InvalidConfigurationFileException(sb.toString()); } settings.setProxies(result.getProxies()); settings.setServers(result.getServers()); return settings; }
throw new InvalidConfigurationFileException("Invalid format settings.xml found: " + userSettingsFile); throw new InvalidConfigurationFileException(sb.toString());
throw new InvalidConfigurationFileException("Invalid format settings.xml found: " + userSettingsFile); throw new InvalidConfigurationFileException(sb.toString());
throw new InvalidConfigurationFileException(sb.toString());
throw new InvalidConfigurationFileException(sb.toString());