void (@NotNull MavenPlugin plugin, @NotNull String goal, @NotNull Consumer<String> addFolder) { for (MavenPlugin.Execution execution : plugin.getExecutions()) { if (execution.getGoals().contains(goal)) { final Element configurationElement = execution.getConfigurationElement(); if (configurationElement != null) { final Element sourcesElement = configurationElement.getChild("resources"); if (sourcesElement != null) { for (Element element : sourcesElement.getChildren()) { Element directory = element.getChild("directory"); if (directory != null) addFolder.accept(directory.getTextTrim()); } } } } } }