static Map<String, String> getCustomGlobalUserProperties() { //maybe set org.eclipse.aether.ConfigurationProperties.USER_AGENT with netbeans specific value. Map<String, String> toRet = new HashMap<String, String>(); String options = getPreferences().get(PROP_DEFAULT_OPTIONS, ""); try { String[] cmdlines = CommandLineUtils.translateCommandline(options); if (cmdlines != null) { for (String cmd : cmdlines) { if (cmd != null && cmd.startsWith("-D")) { cmd = cmd.substring("-D".length()); int ind = cmd.indexOf('='); if (ind > -1) { String key = cmd.substring(0, ind); String val = cmd.substring(ind + 1); toRet.put(key, val); } } } } return toRet; } catch (Exception ex) { LOG.log(Level.FINE, "cannot parse " + options, ex); return Collections.emptyMap(); } }
public static void setMavenHome(File path) { File oldValue = getMavenHome(); File defValue = getDefaultMavenHome(); if (oldValue.equals(path) || path == null && oldValue.equals(defValue)) { //no change happened, prevent resetting the embedders return; } if (path == null || path.equals(defValue)) { getPreferences().remove(PROP_COMMANDLINE_PATH); } else { getPreferences().put(PROP_COMMANDLINE_PATH, FileUtil.normalizeFile(path).getAbsolutePath()); } resetCachedEmbedders(); }
/** * global settings value for maven installation root folder. * @return */ public static @NonNull File getMavenHome() { String str = getPreferences().get(PROP_COMMANDLINE_PATH, null); if (str != null) { return FileUtil.normalizeFile(new File(str)); } else { return getDefaultMavenHome(); } }
/** * @since 2.39 * @param grp * @return */ public static @NonNull File getEffectiveMavenHome(ProjectGroup grp) { Preferences grPref = getGroupedPreferences(grp); String str = grPref != null ? grPref.get(PROP_COMMANDLINE_PATH, null) : null; if (str == null) { str = getPreferences().get(PROP_COMMANDLINE_PATH, null); } if (str != null) { return FileUtil.normalizeFile(new File(str)); } else { return getDefaultMavenHome(); } }