Class AlignOptions
java.lang.Object
eu.maveniverse.domtrip.maven.AlignOptions
Options for controlling how dependencies are aligned with project conventions.
When adding or aligning dependencies, these options specify the version management style, version source, and property naming convention. Null values indicate auto-detection from existing POM conventions.
Usage Examples:
// Auto-detect all conventions
AlignOptions options = AlignOptions.defaults();
// Force managed + property style
AlignOptions options = AlignOptions.builder()
.versionStyle(AlignOptions.VersionStyle.MANAGED)
.versionSource(AlignOptions.VersionSource.PROPERTY)
.build();
// Force specific property name
AlignOptions options = AlignOptions.builder()
.versionSource(AlignOptions.VersionSource.PROPERTY)
.propertyName("junit.version")
.build();
// Custom property naming pattern
AlignOptions options = AlignOptions.builder()
.versionSource(AlignOptions.VersionSource.PROPERTY)
.propertyNameGenerator(coords -> coords.groupId() + "." + coords.artifactId() + ".version")
.build();
// Add with scope
AlignOptions options = AlignOptions.builder()
.scope("test")
.build();
- Since:
- 1.1.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilder forAlignOptions.static enumNaming convention for version properties.static enumWhether the version value is a literal or a property reference.static enumWhether the dependency version is inline or delegated to dependency management. -
Method Summary
Modifier and TypeMethodDescriptionstatic AlignOptions.Builderbuilder()Create a new Builder for constructing AlignOptions.static AlignOptionsdefaults()Create an AlignOptions instance with all conventions set to auto-detect.static StringgeneratePropertyName(Coordinates coords, AlignOptions.PropertyNamingConvention convention) Generates a version property name for the given coordinates and naming convention.The property naming convention to use, or null to indicate auto-detection.Provides the explicit property name override.Custom function that generates property names from dependency coordinates, or null to use convention-based generation.scope()Get the Maven dependency scope configured for this instance.The configured version source, or null to indicate auto-detection.Gets the configured version placement style or defers to auto-detection when unspecified.
-
Method Details
-
defaults
Create an AlignOptions instance with all conventions set to auto-detect.- Returns:
- an AlignOptions whose fields are all
null, indicating auto-detection of conventions - Since:
- 1.1.0
-
builder
Create a new Builder for constructing AlignOptions.- Returns:
- a new Builder instance for configuring and building an AlignOptions object
- Since:
- 1.1.0
-
versionStyle
Gets the configured version placement style or defers to auto-detection when unspecified.- Returns:
- the configured version style, or
nullto indicate auto-detection - Since:
- 1.1.0
-
versionSource
The configured version source, or null to indicate auto-detection.- Returns:
- the version source override, or
nullif auto-detection is used - Since:
- 1.1.0
-
namingConvention
The property naming convention to use, or null to indicate auto-detection.- Returns:
- the naming convention override, or
nullif it should be auto-detected - Since:
- 1.1.0
-
propertyNameGenerator
Custom function that generates property names from dependency coordinates, or null to use convention-based generation.When provided, this function is used to derive property names allowing arbitrary naming patterns beyond the built-in
AlignOptions.PropertyNamingConventionoptions.Precedence: an explicit property name overrides this generator, which overrides an explicit naming convention, which in turn falls back to auto-detection.
- Returns:
- the property name generator, or null
- Since:
- 1.1.0
-
propertyName
Provides the explicit property name override.- Returns:
- the explicit property name override, or
nullto indicate auto-generation - Since:
- 1.1.0
-
scope
Get the Maven dependency scope configured for this instance.May be
nullto indicate the default scope.- Returns:
- the dependency scope (e.g., "test", "provided"), or
nullto use the default - Since:
- 1.1.0
-
generatePropertyName
public static String generatePropertyName(Coordinates coords, AlignOptions.PropertyNamingConvention convention) Generates a version property name for the given coordinates and naming convention.Examples:
DOT_SUFFIX:junit-jupiter.versionDASH_SUFFIX:junit-jupiter-versionCAMEL_CASE:junitJupiterVersionDOT_PREFIX:version.junit-jupiter
- Parameters:
coords- the dependency coordinates (artifactId is used as the base name)convention- the naming convention to apply- Returns:
- the generated property name
- Since:
- 1.1.0
-