Skip to content
Closed
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 @@ -83,6 +83,8 @@
@Singleton
public class DefaultRepositorySystemSessionFactory implements RepositorySystemSessionFactory {

private static final String MAVEN_RESOLVER_BF_COLLECTOR_SKIPPER = "aether.dependencyCollector.bf.skipper";
Comment thread
efegokdemir marked this conversation as resolved.

public static final String MAVEN_RESOLVER_TRANSPORT_DEFAULT = "default";

public static final String MAVEN_RESOLVER_TRANSPORT_WAGON = "wagon";
Expand Down Expand Up @@ -194,6 +196,10 @@ public SessionBuilder newRepositorySessionBuilder(MavenExecutionRequest request)
configProps.put(ConfigurationProperties.INTERACTIVE, request.isInteractiveMode());
configProps.put("maven.startTime", request.getStartTime());
configProps.put(Constants.MAVEN_START_INSTANT, request.getStartInstant());
if (!mergedProps.containsKey(MAVEN_RESOLVER_BF_COLLECTOR_SKIPPER)) {
// Keep dependencies of the eventual version-range winner when another version was visited first.
configProps.put(MAVEN_RESOLVER_BF_COLLECTOR_SKIPPER, "versioned");
}

sessionBuilder.setOffline(request.isOffline());
sessionBuilder.setChecksumPolicy(request.getGlobalChecksumPolicy());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,37 @@ void isSnapshotUpdatesTest() throws InvalidRepositoryException {
systemSessionFactory.newRepositorySession(request).getUpdatePolicy());
}

@Test
void versionedDependencyCollectorSkipperIsDefaultAndCanBeOverridden() throws InvalidRepositoryException {
DefaultRepositorySystemSessionFactory systemSessionFactory = new DefaultRepositorySystemSessionFactory(
aetherRepositorySystem,
eventSpyDispatcher,
information,
defaultTypeRegistry,
versionScheme,
Collections.emptyMap(),
versionFilterBuilder);

MavenExecutionRequest request = new DefaultMavenExecutionRequest();
request.setLocalRepository(getLocalRepository());
assertEquals(
"versioned",
systemSessionFactory
.newRepositorySession(request)
.getConfigProperties()
.get("aether.dependencyCollector.bf.skipper"));

Properties properties = new Properties();
properties.setProperty("aether.dependencyCollector.bf.skipper", "versionless");
request.setSystemProperties(properties);
assertEquals(
"versionless",
systemSessionFactory
.newRepositorySession(request)
.getConfigProperties()
.get("aether.dependencyCollector.bf.skipper"));
}

@Test
void wagonProviderConfigurationTest() throws InvalidRepositoryException {
Server server = new Server();
Expand Down
Loading