Class MavenContext
java.lang.Object
org.jdrupes.builder.mvnrepo.MavenContext
Manages a global instance of RepositorySystem and
RepositorySystemSession and a list of RemoteRepositorys for
use by all instances of MvnRepoLookup and others.
The remote repositories are evaluated by looking up the repositories
from the profiles in settings.xml selected with useProfiles and the
repositories added with addRepository(org.eclipse.aether.repository.RemoteRepository).
-
Method Summary
Modifier and TypeMethodDescriptionstatic Class<MavenContext> addRepository(String id, URI uri, MvnVersionType... supported) Include the repository created from the given values in the result ofremoteRepositories().static Class<MavenContext> addRepository(org.eclipse.aether.repository.RemoteRepository repository) Include the given repository in the result ofremoteRepositories().static booleanlookupCredentials(String serverId, BiConsumer<String, String> consumer) Looks up the credentials for the specified server insettings.xml.static org.eclipse.aether.repository.RemoteRepositoryReturns theRemoteRepositoryfor Maven Central.static org.eclipse.aether.RepositorySystemSessionRepository session.static org.eclipse.aether.RepositorySystemRepository system.static Class<MavenContext> useProfiles(String... profiles) Include repositories from the specified profiles insettings.xmlin the result ofremoteRepositories().
-
Method Details
-
repositorySystem
Repository system.- Returns:
- the repository system
-
repositorySession
Repository session.- Returns:
- the repository system session
-
lookupCredentials
Looks up the credentials for the specified server insettings.xml. Invokes the consumer with the username and password if found.- Parameters:
serverId- the server idconsumer- the consumer- Returns:
- true, if found
-
useProfiles
Include repositories from the specified profiles insettings.xmlin the result ofremoteRepositories().- Parameters:
profiles- the profiles- Returns:
- the Maven context
-
addRepository
public static Class<MavenContext> addRepository(org.eclipse.aether.repository.RemoteRepository repository) Include the given repository in the result ofremoteRepositories().- Parameters:
repository- the repository- Returns:
- the Maven context
-
addRepository
Include the repository created from the given values in the result ofremoteRepositories().- Parameters:
id- the repository iduri- the repository urisupported- the supported version types- Returns:
- the Maven context
-
mavenCentral
Returns theRemoteRepositoryfor Maven Central.- Returns:
- the remote repository
-