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); } } }
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); } }
internal void SaveProfile(IProfile profile, PomElement element) { if (string.IsNullOrEmpty(profile.Id)) { element.RemoveElement("id"); } else { element.SetElementValue("id", profile.Id); } SaveBuildContainer(profile, element); }
// 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); }
public void SaveProperty(IProperty property, PomElement element) { element.SetElementValue(property.Name, property.Value); }