From 8dec40ff57f7c2c749d86b7ab7199b9cf7b439e6 Mon Sep 17 00:00:00 2001 From: Tamas Cservenak Date: Mon, 18 Nov 2024 11:45:50 +0100 Subject: [PATCH] Rename versionFilter property and tidy up documentation (#1920) This property was introduced in 4-alpha-12, so no issue just putting the property in place. --- .../java/org/apache/maven/api/Constants.java | 9 +- ...DefaultRepositorySystemSessionFactory.java | 2 +- ...ultRepositorySystemSessionFactoryTest.java | 16 +-- src/site/markdown/configuration.properties | 100 +++++++++--------- src/site/markdown/configuration.yaml | 12 +-- src/site/markdown/maven-configuration.md | 34 +++--- 6 files changed, 87 insertions(+), 86 deletions(-) diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Constants.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Constants.java index 83b4dec718..a5bebc73f4 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/Constants.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/Constants.java @@ -291,8 +291,8 @@ public final class Constants { public static final String MAVEN_RELOCATIONS_ENTRIES = "maven.relocations.entries"; /** - * User property for version filters expression, a semicolon separated list of filters to apply. By default, no version - * filter is applied (like in Maven 3). + * User property for version filter expression used in session, applied to resolving ranges: a semicolon separated + * list of filters to apply. By default, no version filter is applied (like in Maven 3). *
* Supported filters: * * Example filter expression: "h(5);s;e(org.foo:bar:1) will cause: ranges are filtered for "top 5" (instead * full range), snapshots are banned if root project is not a snapshot, and if range for org.foo:bar is - * being processed, version 1 is omitted. + * being processed, version 1 is omitted. Value in this property builds + * org.eclipse.aether.collection.VersionFilter instance. * * @since 4.0.0 */ @Config - public static final String MAVEN_VERSION_FILTERS = "maven.versionFilters"; + public static final String MAVEN_VERSION_FILTER = "maven.session.versionFilter"; /** * User property for chained LRM: the new "head" local repository to use, and "push" the existing into tail. diff --git a/impl/maven-core/src/main/java/org/apache/maven/internal/aether/DefaultRepositorySystemSessionFactory.java b/impl/maven-core/src/main/java/org/apache/maven/internal/aether/DefaultRepositorySystemSessionFactory.java index b44a172da5..037f8eca2c 100644 --- a/impl/maven-core/src/main/java/org/apache/maven/internal/aether/DefaultRepositorySystemSessionFactory.java +++ b/impl/maven-core/src/main/java/org/apache/maven/internal/aether/DefaultRepositorySystemSessionFactory.java @@ -198,7 +198,7 @@ public class DefaultRepositorySystemSessionFactory implements RepositorySystemSe sessionBuilder.setArtifactDescriptorPolicy(new SimpleArtifactDescriptorPolicy( request.isIgnoreMissingArtifactDescriptor(), request.isIgnoreInvalidArtifactDescriptor())); - VersionFilter versionFilter = buildVersionFilter(mergedProps.get(Constants.MAVEN_VERSION_FILTERS)); + VersionFilter versionFilter = buildVersionFilter(mergedProps.get(Constants.MAVEN_VERSION_FILTER)); if (versionFilter != null) { sessionBuilder.setVersionFilter(versionFilter); } diff --git a/impl/maven-core/src/test/java/org/apache/maven/internal/aether/DefaultRepositorySystemSessionFactoryTest.java b/impl/maven-core/src/test/java/org/apache/maven/internal/aether/DefaultRepositorySystemSessionFactoryTest.java index 1c418322aa..3de57a0da6 100644 --- a/impl/maven-core/src/test/java/org/apache/maven/internal/aether/DefaultRepositorySystemSessionFactoryTest.java +++ b/impl/maven-core/src/test/java/org/apache/maven/internal/aether/DefaultRepositorySystemSessionFactoryTest.java @@ -416,43 +416,43 @@ public class DefaultRepositorySystemSessionFactoryTest { VersionFilter versionFilter; // single one - request.getUserProperties().put("maven.versionFilters", "s"); + request.getUserProperties().put("maven.session.versionFilter", "s"); versionFilter = systemSessionFactory.newRepositorySession(request).getVersionFilter(); assertNotNull(versionFilter); assertTrue(versionFilter instanceof ContextualSnapshotVersionFilter); - request.getUserProperties().put("maven.versionFilters", "h"); + request.getUserProperties().put("maven.session.versionFilter", "h"); versionFilter = systemSessionFactory.newRepositorySession(request).getVersionFilter(); assertNotNull(versionFilter); assertTrue(versionFilter instanceof HighestVersionFilter); - request.getUserProperties().put("maven.versionFilters", "h(5)"); + request.getUserProperties().put("maven.session.versionFilter", "h(5)"); versionFilter = systemSessionFactory.newRepositorySession(request).getVersionFilter(); assertNotNull(versionFilter); assertTrue(versionFilter instanceof HighestVersionFilter); - request.getUserProperties().put("maven.versionFilters", "l"); + request.getUserProperties().put("maven.session.versionFilter", "l"); versionFilter = systemSessionFactory.newRepositorySession(request).getVersionFilter(); assertNotNull(versionFilter); assertTrue(versionFilter instanceof LowestVersionFilter); - request.getUserProperties().put("maven.versionFilters", "l(5)"); + request.getUserProperties().put("maven.session.versionFilter", "l(5)"); versionFilter = systemSessionFactory.newRepositorySession(request).getVersionFilter(); assertNotNull(versionFilter); assertTrue(versionFilter instanceof LowestVersionFilter); - request.getUserProperties().put("maven.versionFilters", "e(g:a:v)"); + request.getUserProperties().put("maven.session.versionFilter", "e(g:a:v)"); versionFilter = systemSessionFactory.newRepositorySession(request).getVersionFilter(); assertNotNull(versionFilter); assertTrue(versionFilter instanceof PredicateVersionFilter); - request.getUserProperties().put("maven.versionFilters", "e(g:a:[1,2])"); + request.getUserProperties().put("maven.session.versionFilter", "e(g:a:[1,2])"); versionFilter = systemSessionFactory.newRepositorySession(request).getVersionFilter(); assertNotNull(versionFilter); assertTrue(versionFilter instanceof PredicateVersionFilter); // chained - request.getUserProperties().put("maven.versionFilters", "h(5);s;e(org.foo:bar:1)"); + request.getUserProperties().put("maven.session.versionFilter", "h(5);s;e(org.foo:bar:1)"); versionFilter = systemSessionFactory.newRepositorySession(request).getVersionFilter(); assertNotNull(versionFilter); assertTrue(versionFilter instanceof ChainedVersionFilter); diff --git a/src/site/markdown/configuration.properties b/src/site/markdown/configuration.properties index fb58752039..6c655cc194 100644 --- a/src/site/markdown/configuration.properties +++ b/src/site/markdown/configuration.properties @@ -160,106 +160,106 @@ props.24.description = Resolver transport to use. Can be default, < props.24.defaultValue = default props.24.since = 4.0.0 props.24.configurationSource = User properties -props.25.key = maven.style.color +props.25.key = maven.session.versionFilter props.25.configurationType = String -props.25.description = Maven output color mode. Allowed values are auto, always, never. -props.25.defaultValue = auto +props.25.description = User property for version filter expression used in session, applied to resolving ranges: a semicolon separated list of filters to apply. By default, no version filter is applied (like in Maven 3).
Supported filters: Example filter expression: "h(5);s;e(org.foo:bar:1) will cause: ranges are filtered for "top 5" (instead full range), snapshots are banned if root project is not a snapshot, and if range for org.foo:bar is being processed, version 1 is omitted. Value in this property builds org.eclipse.aether.collection.VersionFilter instance. +props.25.defaultValue = props.25.since = 4.0.0 props.25.configurationSource = User properties -props.26.key = maven.style.debug +props.26.key = maven.style.color props.26.configurationType = String -props.26.description = Color style for debug messages. -props.26.defaultValue = bold,f:cyan +props.26.description = Maven output color mode. Allowed values are auto, always, never. +props.26.defaultValue = auto props.26.since = 4.0.0 props.26.configurationSource = User properties -props.27.key = maven.style.error +props.27.key = maven.style.debug props.27.configurationType = String -props.27.description = Color style for error messages. -props.27.defaultValue = bold,f:red +props.27.description = Color style for debug messages. +props.27.defaultValue = bold,f:cyan props.27.since = 4.0.0 props.27.configurationSource = User properties -props.28.key = maven.style.failure +props.28.key = maven.style.error props.28.configurationType = String -props.28.description = Color style for failure messages. +props.28.description = Color style for error messages. props.28.defaultValue = bold,f:red props.28.since = 4.0.0 props.28.configurationSource = User properties -props.29.key = maven.style.info +props.29.key = maven.style.failure props.29.configurationType = String -props.29.description = Color style for info messages. -props.29.defaultValue = bold,f:blue +props.29.description = Color style for failure messages. +props.29.defaultValue = bold,f:red props.29.since = 4.0.0 props.29.configurationSource = User properties -props.30.key = maven.style.mojo +props.30.key = maven.style.info props.30.configurationType = String -props.30.description = Color style for mojo messages. -props.30.defaultValue = f:green +props.30.description = Color style for info messages. +props.30.defaultValue = bold,f:blue props.30.since = 4.0.0 props.30.configurationSource = User properties -props.31.key = maven.style.project +props.31.key = maven.style.mojo props.31.configurationType = String -props.31.description = Color style for project messages. -props.31.defaultValue = f:cyan +props.31.description = Color style for mojo messages. +props.31.defaultValue = f:green props.31.since = 4.0.0 props.31.configurationSource = User properties -props.32.key = maven.style.strong +props.32.key = maven.style.project props.32.configurationType = String -props.32.description = Color style for strong messages. -props.32.defaultValue = bold +props.32.description = Color style for project messages. +props.32.defaultValue = f:cyan props.32.since = 4.0.0 props.32.configurationSource = User properties -props.33.key = maven.style.success +props.33.key = maven.style.strong props.33.configurationType = String -props.33.description = Color style for success messages. -props.33.defaultValue = bold,f:green +props.33.description = Color style for strong messages. +props.33.defaultValue = bold props.33.since = 4.0.0 props.33.configurationSource = User properties -props.34.key = maven.style.trace +props.34.key = maven.style.success props.34.configurationType = String -props.34.description = Color style for trace messages. -props.34.defaultValue = bold,f:magenta +props.34.description = Color style for success messages. +props.34.defaultValue = bold,f:green props.34.since = 4.0.0 props.34.configurationSource = User properties -props.35.key = maven.style.transfer +props.35.key = maven.style.trace props.35.configurationType = String -props.35.description = Color style for transfer messages. -props.35.defaultValue = f:bright-black +props.35.description = Color style for trace messages. +props.35.defaultValue = bold,f:magenta props.35.since = 4.0.0 props.35.configurationSource = User properties -props.36.key = maven.style.warning +props.36.key = maven.style.transfer props.36.configurationType = String -props.36.description = Color style for warning messages. -props.36.defaultValue = bold,f:yellow +props.36.description = Color style for transfer messages. +props.36.defaultValue = f:bright-black props.36.since = 4.0.0 props.36.configurationSource = User properties -props.37.key = maven.user.conf +props.37.key = maven.style.warning props.37.configurationType = String -props.37.description = Maven user configuration directory. -props.37.defaultValue = ${user.home}/.m2 +props.37.description = Color style for warning messages. +props.37.defaultValue = bold,f:yellow props.37.since = 4.0.0 props.37.configurationSource = User properties -props.38.key = maven.user.extensions +props.38.key = maven.user.conf props.38.configurationType = String -props.38.description = Maven user extensions. -props.38.defaultValue = ${maven.user.conf}/extensions.xml +props.38.description = Maven user configuration directory. +props.38.defaultValue = ${user.home}/.m2 props.38.since = 4.0.0 props.38.configurationSource = User properties -props.39.key = maven.user.settings +props.39.key = maven.user.extensions props.39.configurationType = String -props.39.description = Maven user settings. -props.39.defaultValue = ${maven.user.conf}/settings.xml +props.39.description = Maven user extensions. +props.39.defaultValue = ${maven.user.conf}/extensions.xml props.39.since = 4.0.0 props.39.configurationSource = User properties -props.40.key = maven.user.toolchains +props.40.key = maven.user.settings props.40.configurationType = String -props.40.description = Maven user toolchains. -props.40.defaultValue = ${maven.user.home}/toolchains.xml +props.40.description = Maven user settings. +props.40.defaultValue = ${maven.user.conf}/settings.xml props.40.since = 4.0.0 props.40.configurationSource = User properties -props.41.key = maven.versionFilters +props.41.key = maven.user.toolchains props.41.configurationType = String -props.41.description = User property for version filters expression, a semicolon separated list of filters to apply. By default, no version filter is applied (like in Maven 3).
Supported filters: Example filter expression: "h(5);s;e(org.foo:bar:1) will cause: ranges are filtered for "top 5" (instead full range), snapshots are banned if root project is not a snapshot, and if range for org.foo:bar is being processed, version 1 is omitted. -props.41.defaultValue = +props.41.description = Maven user toolchains. +props.41.defaultValue = ${maven.user.home}/toolchains.xml props.41.since = 4.0.0 props.41.configurationSource = User properties props.42.key = maven.versionResolver.noCache diff --git a/src/site/markdown/configuration.yaml b/src/site/markdown/configuration.yaml index 83e782881e..9723c93fc2 100644 --- a/src/site/markdown/configuration.yaml +++ b/src/site/markdown/configuration.yaml @@ -160,6 +160,12 @@ props: defaultValue: default since: 4.0.0 configurationSource: User properties + - key: maven.session.versionFilter + configurationType: String + description: "User property for version filter expression used in session, applied to resolving ranges: a semicolon separated list of filters to apply. By default, no version filter is applied (like in Maven 3).
Supported filters: Example filter expression: \"h(5);s;e(org.foo:bar:1) will cause: ranges are filtered for \"top 5\" (instead full range), snapshots are banned if root project is not a snapshot, and if range for org.foo:bar is being processed, version 1 is omitted. Value in this property builds org.eclipse.aether.collection.VersionFilter instance." + defaultValue: + since: 4.0.0 + configurationSource: User properties - key: maven.style.color configurationType: String description: "Maven output color mode. Allowed values are auto, always, never." @@ -256,12 +262,6 @@ props: defaultValue: ${maven.user.home}/toolchains.xml since: 4.0.0 configurationSource: User properties - - key: maven.versionFilters - configurationType: String - description: "User property for version filters expression, a semicolon separated list of filters to apply. By default, no version filter is applied (like in Maven 3).
Supported filters: Example filter expression: \"h(5);s;e(org.foo:bar:1) will cause: ranges are filtered for \"top 5\" (instead full range), snapshots are banned if root project is not a snapshot, and if range for org.foo:bar is being processed, version 1 is omitted." - defaultValue: - since: 4.0.0 - configurationSource: User properties - key: maven.versionResolver.noCache configurationType: Boolean description: "User property for disabling version resolver cache." diff --git a/src/site/markdown/maven-configuration.md b/src/site/markdown/maven-configuration.md index aa8feca27c..794c9ef0b1 100644 --- a/src/site/markdown/maven-configuration.md +++ b/src/site/markdown/maven-configuration.md @@ -49,22 +49,22 @@ under the License. | 22. | `maven.repo.local.tail.ignoreAvailability` | `String` | User property for chained LRM: whether to ignore "availability check" in tail or not. Usually you do want to ignore it. This property is mapped onto corresponding Resolver 2.x property, is like a synonym for it. Default value: true. | - | 3.9.0 | User properties | | 23. | `maven.resolver.dependencyManagerTransitivity` | `String` | User property for selecting dependency manager behaviour regarding transitive dependencies and dependency management entries in their POMs. Maven 3 targeted full backward compatibility with Maven2, hence it ignored dependency management entries in transitive dependency POMs. Maven 4 enables "transitivity" by default, hence unlike Maven2, obeys dependency management entries deep in dependency graph as well.
Default: "true". | `true` | 4.0.0 | User properties | | 24. | `maven.resolver.transport` | `String` | Resolver transport to use. Can be default, wagon, apache, jdk or auto. | `default` | 4.0.0 | User properties | -| 25. | `maven.style.color` | `String` | Maven output color mode. Allowed values are auto, always, never. | `auto` | 4.0.0 | User properties | -| 26. | `maven.style.debug` | `String` | Color style for debug messages. | `bold,f:cyan` | 4.0.0 | User properties | -| 27. | `maven.style.error` | `String` | Color style for error messages. | `bold,f:red` | 4.0.0 | User properties | -| 28. | `maven.style.failure` | `String` | Color style for failure messages. | `bold,f:red` | 4.0.0 | User properties | -| 29. | `maven.style.info` | `String` | Color style for info messages. | `bold,f:blue` | 4.0.0 | User properties | -| 30. | `maven.style.mojo` | `String` | Color style for mojo messages. | `f:green` | 4.0.0 | User properties | -| 31. | `maven.style.project` | `String` | Color style for project messages. | `f:cyan` | 4.0.0 | User properties | -| 32. | `maven.style.strong` | `String` | Color style for strong messages. | `bold` | 4.0.0 | User properties | -| 33. | `maven.style.success` | `String` | Color style for success messages. | `bold,f:green` | 4.0.0 | User properties | -| 34. | `maven.style.trace` | `String` | Color style for trace messages. | `bold,f:magenta` | 4.0.0 | User properties | -| 35. | `maven.style.transfer` | `String` | Color style for transfer messages. | `f:bright-black` | 4.0.0 | User properties | -| 36. | `maven.style.warning` | `String` | Color style for warning messages. | `bold,f:yellow` | 4.0.0 | User properties | -| 37. | `maven.user.conf` | `String` | Maven user configuration directory. | `${user.home}/.m2` | 4.0.0 | User properties | -| 38. | `maven.user.extensions` | `String` | Maven user extensions. | `${maven.user.conf}/extensions.xml` | 4.0.0 | User properties | -| 39. | `maven.user.settings` | `String` | Maven user settings. | `${maven.user.conf}/settings.xml` | 4.0.0 | User properties | -| 40. | `maven.user.toolchains` | `String` | Maven user toolchains. | `${maven.user.home}/toolchains.xml` | 4.0.0 | User properties | -| 41. | `maven.versionFilters` | `String` | User property for version filters expression, a semicolon separated list of filters to apply. By default, no version filter is applied (like in Maven 3).
Supported filters: Example filter expression: "h(5);s;e(org.foo:bar:1) will cause: ranges are filtered for "top 5" (instead full range), snapshots are banned if root project is not a snapshot, and if range for org.foo:bar is being processed, version 1 is omitted. | - | 4.0.0 | User properties | +| 25. | `maven.session.versionFilter` | `String` | User property for version filter expression used in session, applied to resolving ranges: a semicolon separated list of filters to apply. By default, no version filter is applied (like in Maven 3).
Supported filters: Example filter expression: "h(5);s;e(org.foo:bar:1) will cause: ranges are filtered for "top 5" (instead full range), snapshots are banned if root project is not a snapshot, and if range for org.foo:bar is being processed, version 1 is omitted. Value in this property builds org.eclipse.aether.collection.VersionFilter instance. | - | 4.0.0 | User properties | +| 26. | `maven.style.color` | `String` | Maven output color mode. Allowed values are auto, always, never. | `auto` | 4.0.0 | User properties | +| 27. | `maven.style.debug` | `String` | Color style for debug messages. | `bold,f:cyan` | 4.0.0 | User properties | +| 28. | `maven.style.error` | `String` | Color style for error messages. | `bold,f:red` | 4.0.0 | User properties | +| 29. | `maven.style.failure` | `String` | Color style for failure messages. | `bold,f:red` | 4.0.0 | User properties | +| 30. | `maven.style.info` | `String` | Color style for info messages. | `bold,f:blue` | 4.0.0 | User properties | +| 31. | `maven.style.mojo` | `String` | Color style for mojo messages. | `f:green` | 4.0.0 | User properties | +| 32. | `maven.style.project` | `String` | Color style for project messages. | `f:cyan` | 4.0.0 | User properties | +| 33. | `maven.style.strong` | `String` | Color style for strong messages. | `bold` | 4.0.0 | User properties | +| 34. | `maven.style.success` | `String` | Color style for success messages. | `bold,f:green` | 4.0.0 | User properties | +| 35. | `maven.style.trace` | `String` | Color style for trace messages. | `bold,f:magenta` | 4.0.0 | User properties | +| 36. | `maven.style.transfer` | `String` | Color style for transfer messages. | `f:bright-black` | 4.0.0 | User properties | +| 37. | `maven.style.warning` | `String` | Color style for warning messages. | `bold,f:yellow` | 4.0.0 | User properties | +| 38. | `maven.user.conf` | `String` | Maven user configuration directory. | `${user.home}/.m2` | 4.0.0 | User properties | +| 39. | `maven.user.extensions` | `String` | Maven user extensions. | `${maven.user.conf}/extensions.xml` | 4.0.0 | User properties | +| 40. | `maven.user.settings` | `String` | Maven user settings. | `${maven.user.conf}/settings.xml` | 4.0.0 | User properties | +| 41. | `maven.user.toolchains` | `String` | Maven user toolchains. | `${maven.user.home}/toolchains.xml` | 4.0.0 | User properties | | 42. | `maven.versionResolver.noCache` | `Boolean` | User property for disabling version resolver cache. | `false` | 3.0.0 | User properties |