Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename versionFilter property and tidy up documentation #1920

Merged
merged 1 commit into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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).
* <br/>
* Supported filters:
* <ul>
Expand All @@ -303,12 +303,13 @@ public final class Constants {
* </ul>
* Example filter expression: <code>"h(5);s;e(org.foo:bar:1)</code> 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 <code>org.foo:bar</code> is
* being processed, version 1 is omitted.
* being processed, version 1 is omitted. Value in this property builds
* <code>org.eclipse.aether.collection.VersionFilter</code> 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public SessionBuilder newRepositorySessionBuilder(MavenExecutionRequest request)
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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,43 +416,43 @@ void versionFilteringTest() throws InvalidRepositoryException {
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);
Expand Down
100 changes: 50 additions & 50 deletions src/site/markdown/configuration.properties
Original file line number Diff line number Diff line change
Expand Up @@ -160,106 +160,106 @@ props.24.description = Resolver transport to use. Can be <code>default</code>, <
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 <code>auto</code>, <code>always</code>, <code>never</code>.
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). <br/> Supported filters: <ul> <li>"h" or "h(num)" - highest version or top list of highest ones filter</li> <li>"l" or "l(num)" - lowest version or bottom list of lowest ones filter</li> <li>"s" - contextual snapshot filter</li> <li>"e(G:A:V)" - predicate filter (leaves out G:A:V from range, if hit, V can be range)</li> </ul> Example filter expression: <code>"h(5);s;e(org.foo:bar:1)</code> 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 <code>org.foo:bar</code> is being processed, version 1 is omitted. Value in this property builds <code>org.eclipse.aether.collection.VersionFilter</code> 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 <code>auto</code>, <code>always</code>, <code>never</code>.
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). <br/> Supported filters: <ul> <li>"h" or "h(num)" - highest version or top list of highest ones filter</li> <li>"l" or "l(num)" - lowest version or bottom list of lowest ones filter</li> <li>"s" - contextual snapshot filter</li> <li>"e(G:A:V)" - predicate filter (leaves out G:A:V from range, if hit, V can be range)</li> </ul> Example filter expression: <code>"h(5);s;e(org.foo:bar:1)</code> 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 <code>org.foo:bar</code> 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
Expand Down
12 changes: 6 additions & 6 deletions src/site/markdown/configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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). <br/> Supported filters: <ul> <li>\"h\" or \"h(num)\" - highest version or top list of highest ones filter</li> <li>\"l\" or \"l(num)\" - lowest version or bottom list of lowest ones filter</li> <li>\"s\" - contextual snapshot filter</li> <li>\"e(G:A:V)\" - predicate filter (leaves out G:A:V from range, if hit, V can be range)</li> </ul> Example filter expression: <code>\"h(5);s;e(org.foo:bar:1)</code> 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 <code>org.foo:bar</code> is being processed, version 1 is omitted. Value in this property builds <code>org.eclipse.aether.collection.VersionFilter</code> instance."
defaultValue:
since: 4.0.0
configurationSource: User properties
- key: maven.style.color
configurationType: String
description: "Maven output color mode. Allowed values are <code>auto</code>, <code>always</code>, <code>never</code>."
Expand Down Expand Up @@ -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). <br/> Supported filters: <ul> <li>\"h\" or \"h(num)\" - highest version or top list of highest ones filter</li> <li>\"l\" or \"l(num)\" - lowest version or bottom list of lowest ones filter</li> <li>\"s\" - contextual snapshot filter</li> <li>\"e(G:A:V)\" - predicate filter (leaves out G:A:V from range, if hit, V can be range)</li> </ul> Example filter expression: <code>\"h(5);s;e(org.foo:bar:1)</code> 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 <code>org.foo:bar</code> 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."
Expand Down
Loading