예제 #1
0
        protected void SavePlugin(IPlugin plugin, PomElement element)
        {
            SaveProjectReference(plugin, element);

            if (plugin.Extensions)
            {
                element.SetElementValue("extensions", "true");
            }

            if (!plugin.Configuration.IsEmpty)
            {
                element.Add(plugin.Configuration.Value as PomElement);
            }

            if (!plugin.Executions.IsEmpty)
            {
                element.Add(plugin.Executions.Value as PomElement);
            }

            if (!plugin.Dependencies.Any())
            {
                element.RemoveElement("dependencies");
            }
            else
            {
                var dependenciesNode = element.SingleOrCreate("dependencies");
                dependenciesNode.RemoveAllChildElements();
                foreach (IDependency dependency in plugin.Dependencies)
                {
                    var dependencyNode = dependenciesNode.AddElement("dependency");
                    SaveDependency(dependency, dependencyNode);
                }
            }
        }
예제 #2
0
        internal void SaveDependency(IDependency dependency, PomElement element)
        {
            SaveProjectReference(dependency, element);

            element.SetElementValue("type", dependency.Type);
            element.SetElementValue("classifier", dependency.Classifier);
            element.SetElementValue("scope", dependency.Scope);

            if (dependency.Optional)
            {
                element.SetElementValue("optional", "true");
            }

            if (!dependency.Exclusions.IsEmpty)
            {
                element.Add(dependency.Exclusions.Value as PomElement);
            }
        }