Package eu.maveniverse.domtrip.maven
package eu.maveniverse.domtrip.maven
Maven-specific extensions for the DomTrip XML editing library.
This package provides specialized classes for working with Maven POM files, extending the core DomTrip functionality with Maven-specific features:
PomEditor- Specialized editor for Maven POM filesMavenPomElements- Constants for Maven POM elements and attributes
Key Features
- Maven Element Ordering - Automatically orders elements according to Maven conventions
- Formatting Preservation - Maintains original formatting, whitespace, and comments
- Intelligent Blank Lines - Adds appropriate blank lines between element groups
- Maven-specific Methods - Convenience methods for common POM operations
Usage Example
// Parse existing POM
Document doc = Document.of(pomXmlString);
PomEditor editor = new PomEditor(doc);
// Add elements with proper ordering
Element root = editor.root();
editor.insertMavenElement(root, "description", "My project description");
editor.insertMavenElement(root, "name", "My Project"); // Will be ordered before description
// Add dependencies
Element dependencies = editor.findChildElement(root, "dependencies");
if (dependencies == null) {
dependencies = editor.insertMavenElement(root, "dependencies");
}
editor.addDependency(dependencies, "org.junit.jupiter", "junit-jupiter", "5.9.2");
// Serialize with preserved formatting
String result = editor.toXml();
- Since:
- 0.1
-
ClassDescriptionAbstract base class for Maven-specific editors that provides common element ordering functionality.Options for controlling how dependencies are aligned with project conventions.Builder for
AlignOptions.Naming convention for version properties.Whether the version value is a literal or a property reference.Whether the dependency version is inline or delegated to dependency management.Represents Maven coordinates (groupId, artifactId, version, classifier, and type).Specialized editor for Maven extensions.xml files.Constants for Maven extensions.xml elements, attributes, and other XML constructs.XML attribute constants used in Maven extensions.Common XML element names used in Maven extensions.xml files.Common file and directory names.Maven extensions namespace constants.Schema location constants.Common values and defaults for extensions elements.Constants for Maven POM elements, attributes, and other XML constructs.XML attribute constants used in Maven POMs.Common XML element names used in Maven POMs.Common file and directory names.Common indentation patterns for XML formatting.Maven model version constants.Maven namespace constants.Common Maven plugin constants.Schema location constants.Constants for Maven settings.xml elements, attributes, and other XML constructs.XML attribute constants used in Maven settings.Common XML element names used in Maven settings.xml files.Common file and directory names.Maven settings namespace constants.Schema location constants.Common values and defaults for settings elements.Constants for Maven toolchains.xml elements, attributes, and other XML constructs.XML attribute constants used in Maven toolchains.Common XML element names used in Maven toolchains.xml files.Common file and directory names.Maven toolchains namespace constants.Schema location constants.Common toolchain types.Common values for toolchain elements.Specialized editor for Maven POM files that extends the baseEditorclass with Maven-specific functionality and element ordering.Specialized editor for Maven settings.xml files.Specialized editor for Maven toolchains.xml files.