Class Context
- All Implemented Interfaces:
Closeable,AutoCloseable
RepositorySystem, RepositorySystemSession and list of
RemoteRepository. Context is Closeable, ideally used in try-with-resource constructs.
The very first context instance application creates using Runtime.create(ContextOverrides) is called "root
context", and creation of it can be considered "heavy" operation (runtime dependent). Root context should be kept
open as long as application is expected to make use of Resolver.
Context instances may be customized with customize(ContextOverrides) method, in that case the returned
context is "derived" from this context. In those cases the context instances should be handled "as nested", so
closed in opposite order as they were obtained. Creating customized contexts can be considered "light" operation,
as they merely alter the RepositorySystemSession instance and repositories, while the
RepositorySystem is just inherited from this instance (is not reconstructed).
-
Constructor Summary
ConstructorsConstructorDescriptionContext(RuntimeSupport runtime, ContextOverrides contextOverrides, org.eclipse.aether.RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystemSession repositorySystemSession, List<org.eclipse.aether.repository.RemoteRepository> remoteRepositories, Runnable managedCloser) -
Method Summary
Modifier and TypeMethodDescriptionbasedir()Shortcut forContextOverrides.getBasedir(), nevernull.voidclose()Closes the context.Returns theContextOverrides, nevernull.customize(ContextOverrides overrides) Returns a newContextinstance, that is customized using passed inContextOverrides, using this instance as "base".Returns effectiveContextOverrides.MavenSystemHome, may benull, if no Maven Home discovered.Returns effectiveContextOverrides.MavenUserHome, nevernull.List<org.eclipse.aether.repository.RemoteRepository>Returns the list ofRemoteRepository, nevernull.org.eclipse.aether.RepositorySystemReturns theRepositorySystem, nevernull.org.eclipse.aether.RepositorySystemSessionReturns theRepositorySystemSession, nevernull.
-
Constructor Details
-
Context
public Context(RuntimeSupport runtime, ContextOverrides contextOverrides, org.eclipse.aether.RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystemSession repositorySystemSession, List<org.eclipse.aether.repository.RemoteRepository> remoteRepositories, Runnable managedCloser)
-
-
Method Details
-
contextOverrides
Returns theContextOverrides, nevernull.- Since:
- 2.1.0
-
basedir
Shortcut forContextOverrides.getBasedir(), nevernull.- Since:
- 2.3.0
-
mavenUserHome
Returns effectiveContextOverrides.MavenUserHome, nevernull.- Since:
- 2.1.0
-
mavenSystemHome
Returns effectiveContextOverrides.MavenSystemHome, may benull, if no Maven Home discovered.- Since:
- 2.1.0
-
repositorySystemSession
public org.eclipse.aether.RepositorySystemSession repositorySystemSession()Returns theRepositorySystemSession, nevernull. -
repositorySystem
public org.eclipse.aether.RepositorySystem repositorySystem()Returns theRepositorySystem, nevernull. -
remoteRepositories
Returns the list ofRemoteRepository, nevernull. -
customize
Returns a newContextinstance, that is customized using passed inContextOverrides, using this instance as "base". -
close
public void close()Closes the context. Once closed context instance should not be used anymore.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-