public static synchronized MavenSettingsSingleton getInstance() { if (instance == null) { instance = new MavenSettingsSingleton(); } return instance; } /**
/** * this method should rather use the embedder's settings, however there's no clear * way of retrieving/using them. * @deprecated rather not use, doesn't contain the global setting values */ @Deprecated public Settings getSettings() { //TODO need probably some kind of caching.. Settings sets = createUserSettingsModel(); if (sets.getLocalRepository() == null) { sets.setLocalRepository(new File(getM2UserDir(), "repository").toString()); } return sets; }
public Settings createUserSettingsModel() { Settings sets = null; File dir = getM2UserDir(); try { File fil = new File(dir, "settings.xml"); if (fil.exists()) { sets = builder.read(new InputStreamReader(new FileInputStream(fil))); } } catch (IOException ex) { ex.printStackTrace(); } catch (XmlPullParserException ex) { ex.printStackTrace(); } if (sets == null) { sets = new Settings(); } return sets; }