Package io.smallrye.beanbag.maven
Class MavenFactory
- java.lang.Object
-
- io.smallrye.beanbag.maven.MavenFactory
-
public final class MavenFactory extends Object
A factory for objects that are useful for resolving dependencies via Maven.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static MavenFactorycreate()Create a new factory.static MavenFactorycreate(ClassLoader classLoader)Create a new factory.static MavenFactorycreate(ClassLoader classLoader, Consumer<io.smallrye.beanbag.BeanBag.Builder> configurator)Create a new factory.static MavenFactorycreate(ClassLoader classLoader, Consumer<io.smallrye.beanbag.BeanBag.Builder> configurator, io.smallrye.beanbag.DependencyFilter dependencyFilter)Create a new factory.static MavenFactorycreate(List<ClassLoader> classLoaders, Consumer<io.smallrye.beanbag.BeanBag.Builder> configurator, io.smallrye.beanbag.DependencyFilter dependencyFilter)Create a new factory.static List<org.eclipse.aether.repository.RemoteRepository>createRemoteRepositoryList(org.apache.maven.settings.Settings settings)Create a remote repository list from the given settings.org.eclipse.aether.RepositorySystemSessioncreateSession(org.apache.maven.settings.Settings settings)Create a repository system session using the given settings with reasonable default behavior.static org.apache.maven.settings.SettingscreateSettings(File globalSettings, File userSettings, Consumer<org.apache.maven.settings.building.SettingsProblem> problemHandler)Create a basic settings instance using reasonable defaults.org.apache.maven.settings.SettingscreateSettingsFromContainer(File globalSettings, File userSettings, Consumer<org.apache.maven.settings.building.SettingsProblem> problemHandler)Create a basic settings from the containerSettingsBuilderusing reasonable defaults.static StringBuilderdumpSettings(StringBuilder sb, org.apache.maven.settings.Settings settings, int indent)Dump the given settings to a string.static StringdumpSettings(org.apache.maven.settings.Settings settings)Dump the given settings to a string.io.smallrye.beanbag.BeanBaggetContainer()Get the bean container used to set up the Maven environment.static FilegetGlobalSettingsLocation()Get the location of the global settings file, if it can be determined.org.eclipse.aether.RepositorySystemgetRepositorySystem()Locate the Maven repository system instance.org.apache.maven.settings.building.SettingsBuildergetSettingsBuilder()Locate the Maven settings builder instance.static FilegetUserSettingsLocation()Get the location of the user settings file, if it can be determined.
-
-
-
Method Detail
-
create
public static MavenFactory create(List<ClassLoader> classLoaders, Consumer<io.smallrye.beanbag.BeanBag.Builder> configurator, io.smallrye.beanbag.DependencyFilter dependencyFilter)
Create a new factory. The given class loader instances are used to find the components of the Maven resolver.- Parameters:
classLoaders- the class loaders to search (must not benull)configurator- an additional configurator which can be used to modify the container configuration (must not benull)dependencyFilter- a filter which can be used to exclude certain implementations (must not benull)- Returns:
- the Maven factory instance (not
null)
-
create
public static MavenFactory create(ClassLoader classLoader, Consumer<io.smallrye.beanbag.BeanBag.Builder> configurator, io.smallrye.beanbag.DependencyFilter dependencyFilter)
Create a new factory. The given class loader instance is used to find the components of the Maven resolver.- Parameters:
classLoader- the class loader (must not benull)configurator- an additional configurator which can be used to modify the container configuration (must not benull)dependencyFilter- a filter which can be used to exclude certain implementations (must not benull)- Returns:
- the Maven factory instance (not
null)
-
create
public static MavenFactory create(ClassLoader classLoader, Consumer<io.smallrye.beanbag.BeanBag.Builder> configurator)
Create a new factory. The given class loader instance is used to find the components of the Maven resolver.- Parameters:
classLoader- the class loader (must not benull)configurator- an additional configurator which can be used to modify the container configuration (must not benull)- Returns:
- the Maven factory instance (not
null)
-
create
public static MavenFactory create(ClassLoader classLoader)
Create a new factory. The given class loader instance is used to find the components of the Maven resolver.- Parameters:
classLoader- the class loader (must not benull)- Returns:
- the Maven factory instance (not
null)
-
create
public static MavenFactory create()
Create a new factory. The caller's class loader instance is used to find the components of the Maven resolver.- Returns:
- the Maven factory instance (not
null)
-
getContainer
public io.smallrye.beanbag.BeanBag getContainer()
Get the bean container used to set up the Maven environment.- Returns:
- the container (not
null)
-
getRepositorySystem
public org.eclipse.aether.RepositorySystem getRepositorySystem() throws io.smallrye.beanbag.BeanInstantiationExceptionLocate the Maven repository system instance.- Returns:
- the repository system instance (not
null) - Throws:
io.smallrye.beanbag.BeanInstantiationException- if there is some problem finding or creating the repository system instance
-
getSettingsBuilder
public org.apache.maven.settings.building.SettingsBuilder getSettingsBuilder() throws io.smallrye.beanbag.BeanInstantiationExceptionLocate the Maven settings builder instance.- Returns:
- the repository system instance (not
null) - Throws:
io.smallrye.beanbag.BeanInstantiationException- if there is some problem finding or creating the repository system instance
-
createSettingsFromContainer
public org.apache.maven.settings.Settings createSettingsFromContainer(File globalSettings, File userSettings, Consumer<org.apache.maven.settings.building.SettingsProblem> problemHandler) throws org.apache.maven.settings.building.SettingsBuildingException
Create a basic settings from the containerSettingsBuilderusing reasonable defaults.- Parameters:
globalSettings- the global settings file (may benullif none)userSettings- the user settings file (may benullif none)problemHandler- the problem handler (may benullif none)- Returns:
- the settings (not
null) - Throws:
org.apache.maven.settings.building.SettingsBuildingException- if creating the settings has failed
-
createSettings
public static org.apache.maven.settings.Settings createSettings(File globalSettings, File userSettings, Consumer<org.apache.maven.settings.building.SettingsProblem> problemHandler) throws org.apache.maven.settings.building.SettingsBuildingException
Create a basic settings instance using reasonable defaults.- Parameters:
globalSettings- the global settings file (may benullif none)userSettings- the user settings file (may benullif none)problemHandler- the problem handler (may benullif none)- Returns:
- the settings (not
null) - Throws:
org.apache.maven.settings.building.SettingsBuildingException- if creating the settings has failed
-
createSession
public org.eclipse.aether.RepositorySystemSession createSession(org.apache.maven.settings.Settings settings) throws io.smallrye.beanbag.BeanInstantiationExceptionCreate a repository system session using the given settings with reasonable default behavior.- Parameters:
settings- the settings to use (must not benull)- Returns:
- the repository system session (not
null) - Throws:
io.smallrye.beanbag.BeanInstantiationException- if there is some problem finding or creating the repository system instance
-
createRemoteRepositoryList
public static List<org.eclipse.aether.repository.RemoteRepository> createRemoteRepositoryList(org.apache.maven.settings.Settings settings)
Create a remote repository list from the given settings.- Parameters:
settings- the settings (must not benull)- Returns:
- the remote repository list (not
null)
-
getGlobalSettingsLocation
public static File getGlobalSettingsLocation()
Get the location of the global settings file, if it can be determined. The file may or may not actually exist.- Returns:
- the location of the global settings file, or
nullif it cannot be determined
-
getUserSettingsLocation
public static File getUserSettingsLocation()
Get the location of the user settings file, if it can be determined. The file may or may not actually exist.- Returns:
- the location of the user settings file, or
nullif it cannot be determined
-
dumpSettings
public static String dumpSettings(org.apache.maven.settings.Settings settings)
Dump the given settings to a string. Any passwords or secrets in the settings are masked. This is mainly useful for debugging; the output format may change and is not intended to be parsed by machines.- Parameters:
settings- the settings to dump (must not benull)- Returns:
- a string containing the dump of the settings
-
dumpSettings
public static StringBuilder dumpSettings(StringBuilder sb, org.apache.maven.settings.Settings settings, int indent)
Dump the given settings to a string. Any passwords or secrets in the settings are masked. This is mainly useful for debugging; the output format may change and is not intended to be parsed by machines.- Parameters:
sb- the string builder to append to (must not benull)settings- the settings to dump (must not benull)indent- the indentation level- Returns:
- the string builder
sb
-
-