protected void AddPluginExecution(Plugin plugin, string id, string[] goals, string phase) { if (goals.Length == 0) { throw new Exception("Plugin execution must contain goals"); } List <PluginExecution> list = new List <PluginExecution>(); if (plugin.executions == null) { plugin.executions = new List <PluginExecution>().ToArray(); list.AddRange(plugin.executions); } PluginExecution exe = new PluginExecution(); exe.id = id; exe.goals = goals; exe.phase = phase; list.Add(exe); plugin.executions = list.ToArray(); }
void addPluginExecution(Plugin plugin, string goal, string phase) { if (string.IsNullOrEmpty(goal)) { // there is nothing to write return; } if (!isExistingPluginExecution(plugin, goal)) { List<PluginExecution> list = new List<PluginExecution>(); if (plugin.executions == null) { plugin.executions = new List<PluginExecution>().ToArray(); list.AddRange(plugin.executions); } else { list.AddRange(plugin.executions); } PluginExecution exe = new PluginExecution(); exe.goals = new string[] { goal }; list.Add(exe); plugin.executions = list.ToArray(); } }
protected void AddPluginExecution(Plugin plugin, string id, string[] goals, string phase, Dictionary<string,string> configuration) { if (goals.Length == 0) throw new Exception("Plugin execution must contain goals"); List<PluginExecution> list = new List<PluginExecution>(); if (plugin.executions == null) { plugin.executions = new List<PluginExecution>().ToArray(); list.AddRange(plugin.executions); } PluginExecution exe = new PluginExecution(); exe.id = id; exe.goals = goals; exe.phase = phase; if (configuration != null) { PluginExecutionConfiguration config = new PluginExecutionConfiguration(); List<XmlElement> elems = new List<XmlElement>(); XmlDocument xmlDocument = new XmlDocument(); foreach (string key in configuration.Keys) { XmlElement elem = xmlDocument.CreateElement(key, @"http://maven.apache.org/POM/4.0.0"); elem.InnerText = configuration[key]; elems.Add(elem); } config.Any = elems.ToArray(); exe.configuration = config; } list.Add(exe); plugin.executions = list.ToArray(); }