Maven Extension Overview
The DomTrip Maven extension (domtrip-maven
) provides specialized functionality for working with Maven configuration files, extending the core DomTrip library with Maven-specific features and conventions.
Key Features
ποΈ Maven-Aware Element Ordering
The PomEditor
automatically orders elements according to Maven POM conventions:
- Project elements:
modelVersion
,parent
,groupId
,artifactId
,version
,packaging
,name
,description
, etc. - Build elements:
defaultGoal
,directory
,finalName
,sourceDirectory
, etc. - Plugin elements:
groupId
,artifactId
,version
,extensions
,executions
, etc. - Dependency elements:
groupId
,artifactId
,version
,classifier
,type
,scope
, etc.
π Intelligent Blank Line Management
Automatically adds appropriate blank lines between element groups to maintain readable POM structure:
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.example</groupId>
<artifactId>parent</artifactId>
<version>1.0.0</version>
</parent>
<groupId>com.example</groupId>
<artifactId>my-project</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<name>My Project</name>
<description>An example project</description>
</project>
π― Convenience Methods
Specialized methods for common Maven operations:
- PomEditor:
addDependency()
,addPlugin()
,addModule()
,addProperty()
- SettingsEditor:
addServer()
,addMirror()
,addProxy()
,addProfile()
- ExtensionsEditor:
addExtension()
with proper coordinates - ToolchainsEditor:
addJdkToolchain()
,addNetBeansToolchain()
,addToolchain()
π§ Type-Safe Constants
Comprehensive constants classes for all Maven file types:
- MavenPomElements: POM elements, attributes, namespaces, and schema locations
- MavenSettingsElements: Settings elements, values, and configuration options
- MavenExtensionsElements: Extensions elements and common extension types
- MavenToolchainsElements: Toolchain elements, types, and common vendors
Architecture
The Maven extension is built on top of the core DomTrip library:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β domtrip-maven β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ ββββββββββββ
β β PomEditor β βSettingsEditorβ βExtensionsEd.β βToolchainββ
β β β β β β β βEditor ββ
β β - POM β β - Settings β β - Extensionsβ β - Tool ββ
β β ordering β β ordering β β ordering β β chainsββ
β β - Deps/ β β - Servers/ β β - Extension β β - JDK ββ
β β Plugins β β Mirrors β β coords β β setup ββ
β βββββββββββββββ βββββββββββββββ βββββββββββββββ ββββββββββββ
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β Constants Classes ββ
β β MavenPomElements | MavenSettingsElements | ββ
β β MavenExtensionsElements | MavenToolchainsElements ββ
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β domtrip-core β
β βββββββββββββββ βββββββββββββββββββ ββββββββββββββββββββββββ
β β Editor β β Document β β Configuration ββ
β β β β β β ββ
β β - Lossless β β - Parsing β β - Formatting ββ
β β editing β β - Serialization β β - Whitespace ββ
β β - Formattingβ β - Navigation β β - Indentation ββ
β β preserve β β - Validation β β ββ
β βββββββββββββββ βββββββββββββββββββ ββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Use Cases
The Maven extension is perfect for:
π οΈ Maven Tooling Development
- Build tools that need to modify POM files
- IDE plugins for Maven project management
- Automated dependency management tools
- POM validation and cleanup utilities
π POM Transformation
- Upgrading Maven versions while preserving formatting
- Migrating between different Maven configurations
- Batch updates across multiple projects
- Template-based POM generation
π POM Analysis
- Dependency analysis tools
- Security scanning with POM modification
- License compliance checking
- Build optimization tools
Comparison with Standard XML Libraries
Feature | Standard XML | DomTrip Core | DomTrip Maven |
---|---|---|---|
Formatting Preservation | β | β | β |
Comment Preservation | β | β | β |
Whitespace Preservation | β | β | β |
Maven Element Ordering | β | β | β |
Maven Conventions | β | β | β |
POM-specific Methods | β | β | β |
Maven Constants | β | β | β |
Getting Started
Ready to start using the Maven extension? Check out:
- Installation Guide - Add the Maven extension to your project
- Quick Start - Your first POM editing example
- API Reference - Complete PomEditor API documentation
- Examples - Real-world usage examples
Next Steps
- Learn about Maven-specific installation
- Try the Maven quick start guide
- Explore element ordering rules
- Browse Maven examples