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

Alter session for version discovery #965

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
import org.eclipse.aether.DefaultRepositorySystemSession;
import org.eclipse.aether.repository.AuthenticationContext;
import org.eclipse.aether.repository.RemoteRepository;
import org.eclipse.aether.repository.RepositoryPolicy;
Expand Down Expand Up @@ -273,11 +274,15 @@ public ArtifactVersions lookupArtifactVersions(
repositories = emptyList();
}

// in future sessions may become AutoCloseable, so all this would go into try-with-resource block
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be marked with TODO then

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unsure, i just left it here. IMHO is not TODO as session is NOT YET AutoCloseable, may be 1.11.x or maybe 2.0 but nobody can tell WHEN it will be. OTOH, "TODO" would mean "do it if you can", but it cannot be done today.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOTE?

DefaultRepositorySystemSession versionDiscoverSession =
new DefaultRepositorySystemSession(mavenSession.getRepositorySession());
versionDiscoverSession.setUpdatePolicy(RepositoryPolicy.UPDATE_POLICY_ALWAYS);
return new ArtifactVersions(
artifact,
aetherRepositorySystem
.resolveVersionRange(
mavenSession.getRepositorySession(),
versionDiscoverSession,
new VersionRangeRequest(
toArtifact(artifact)
.setVersion(ofNullable(versionRange)
Expand Down