public Set<String> getAvailableGoals() { Set<String> cached = goalsRef != null ? goalsRef.get() :null; if (cached == null) { File expandedPath = InstalledFileLocator.getDefault().locate("maven2/maven-plugins-xml", null, false); //NOI18N assert expandedPath != null : "Shall have path expanded.."; //NOI18N //TODO we should have a "resolved instance here with defaults injected correctly List<String> groups = MavenSettingsSingleton.getInstance().getSettings().getPluginGroups(); groups.add("org.apache.maven.plugins"); //NOI18N groups.add("org.codehaus.mojo"); //NOI18N cached = new TreeSet<String>(); for (String group : groups) { File folder = new File(expandedPath, group.replace('.', File.separatorChar)); checkFolder(folder, cached, false); } goalsRef = new WeakReference<Set<String>>(cached); } return cached; }