Ejemplo n.º 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);
                }
            }
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 3
0
 internal void SaveProfile(IProfile profile, PomElement element)
 {
     if (string.IsNullOrEmpty(profile.Id))
     {
         element.RemoveElement("id");
     }
     else
     {
         element.SetElementValue("id", profile.Id);
     }
     SaveBuildContainer(profile, element);
 }
Ejemplo n.º 4
0
 // REVIEW: element is not PomDocument, it is wrapper XElement (dependency, parent)
 internal void SaveProjectReference(IProjectReference projectReference, PomElement element)
 {
     element.SetElementValue("groupId", projectReference.GroupId);
     element.SetElementValue("artifactId", projectReference.ArtifactId);
     element.SetElementValue("version", projectReference.Version.Value);
 }
Ejemplo n.º 5
0
 public void SaveProperty(IProperty property, PomElement element)
 {
     element.SetElementValue(property.Name, property.Value);
 }