Package maventest
Class MavenRepositorySettings
- java.lang.Object
-
- maventest.MavenRepositorySettings
-
public class MavenRepositorySettings extends java.lang.Object
An encapsulation of settings required to be handle Maven dependency resolution. It holds links to local and remote repositories. Maven can be configured externally, using following properties:-
-
Constructor Summary
Constructors Constructor Description MavenRepositorySettings()
Creates a new Maven settings using default user settings, that is the one located in ${user.home}/.m2/settings.xml.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static org.sonatype.aether.repository.RepositoryPolicy
asRepositoryPolicy(org.apache.maven.model.RepositoryPolicy policy)
protected static org.sonatype.aether.repository.RepositoryPolicy
asRepositoryPolicy(org.apache.maven.settings.RepositoryPolicy policy)
void
buildSettings(org.apache.maven.settings.building.SettingsBuildingRequest request)
Replaces currents settings with ones retrieved from request.org.sonatype.aether.repository.LocalRepository
getLocalRepository()
Returns a local repository determined from settings.xml or the default repository locatedjava.util.List<org.sonatype.aether.repository.RemoteRepository>
getRemoteRepositories()
Returns a list of available remote repositoriesvoid
setRemoteRepositories(org.apache.maven.model.Model model)
Sets a list of remote repositories using a POM model.
-
-
-
Constructor Detail
-
MavenRepositorySettings
public MavenRepositorySettings()
Creates a new Maven settings using default user settings, that is the one located in ${user.home}/.m2/settings.xml. Appends Maven Central repository to available remote repositories. The file is used to track local Maven repository.
-
-
Method Detail
-
setRemoteRepositories
public void setRemoteRepositories(org.apache.maven.model.Model model)
Sets a list of remote repositories using a POM model. Maven Central repository and repositories from Maven settings.xml file are always added even if they are not explicitly listed in the the model.- Parameters:
model
- the POM model
-
asRepositoryPolicy
protected static org.sonatype.aether.repository.RepositoryPolicy asRepositoryPolicy(org.apache.maven.model.RepositoryPolicy policy)
-
getRemoteRepositories
public java.util.List<org.sonatype.aether.repository.RemoteRepository> getRemoteRepositories()
Returns a list of available remote repositories- Returns:
- The list of remote repositories
-
getLocalRepository
public org.sonatype.aether.repository.LocalRepository getLocalRepository()
Returns a local repository determined from settings.xml or the default repository located- Returns:
- The local repository
-
buildSettings
public void buildSettings(org.apache.maven.settings.building.SettingsBuildingRequest request)
Replaces currents settings with ones retrieved from request. The list of remote repositories is not affected.- Parameters:
request
- The request for new settings
-
asRepositoryPolicy
protected static org.sonatype.aether.repository.RepositoryPolicy asRepositoryPolicy(org.apache.maven.settings.RepositoryPolicy policy)
-
-
-