ShrinkWrap Resolver Maven Implementation 2.0.0-alpha-2

org.jboss.shrinkwrap.resolver.impl.maven
Interface MavenWorkingSession

All Known Implementing Classes:
MavenWorkingSessionImpl

public interface MavenWorkingSession

Encapsulates Maven session

Author:
Karel Piwko

Method Summary
 void disableClassPathWorkspaceReader()
          Disables the classpath workspace reader which may be used to resolve from dependencies on the ClassPath
 void disableMavenCentral()
          Disables use of the Maven Central Repository
 Collection<org.sonatype.aether.resolution.ArtifactResult> execute(org.sonatype.aether.collection.CollectRequest request, MavenResolutionFilter filter)
           
 MavenWorkingSession execute(org.apache.maven.model.building.ModelBuildingRequest request)
          Loads an effective POM file and updates session settings accordingly.
 MavenWorkingSession execute(org.apache.maven.settings.building.SettingsBuildingRequest request)
          Loads Maven configuration and updates session settings accordingly.
 org.sonatype.aether.artifact.ArtifactTypeRegistry getArtifactTypeRegistry()
          Gets registry of the known artifact types based on underlying session
 Set<MavenDependency> getDeclaredDependencies()
          Metadata for all defined elements
 List<MavenDependency> getDependencies()
          Gets the Set of dependencies to be resolved for this session
 Set<MavenDependency> getDependencyManagement()
          Gets a set af dependency declarations stored in version management.
 org.apache.maven.model.Model getModel()
          Returns underlying Maven model for parsed POM file.
 List<org.sonatype.aether.repository.RemoteRepository> getRemoteRepositories()
          Returns a list of remote repositories enabled from Maven settings.
 List<org.apache.maven.model.Profile> getSettingsDefinedProfiles()
          Gets a list of profiles defined in settings.xml.
 MavenWorkingSession regenerateSession()
          Refreshes underlying Aether session in order to contain newly acquired information, such as new settings.xml content
 void setOffline(boolean offline)
          Whether or not to set this session in "offline" mode
 

Method Detail

getDependencyManagement

Set<MavenDependency> getDependencyManagement()
Gets a set af dependency declarations stored in version management. These dependency declarations are used to get versions if none are specified in MavenDependency#getAddress() address and also affect transitive dependency resolutions.

Returns:
Set of defined MavenDependencys

getDependencies

List<MavenDependency> getDependencies()
Gets the Set of dependencies to be resolved for this session

Returns:
MavenDependencys to be resolved as part of the request to the backend; may be a subset of getDeclaredDependencies() after pre-request filtering has been done

getDeclaredDependencies

Set<MavenDependency> getDeclaredDependencies()
Metadata for all defined elements

Returns:

execute

MavenWorkingSession execute(org.apache.maven.model.building.ModelBuildingRequest request)
                            throws org.jboss.shrinkwrap.resolver.api.InvalidConfigurationFileException
Loads an effective POM file and updates session settings accordingly.

Parameters:
request - Request to load the effective POM file
Returns:
Modified session instance
Throws:
org.jboss.shrinkwrap.resolver.api.InvalidConfigurationFileException

execute

MavenWorkingSession execute(org.apache.maven.settings.building.SettingsBuildingRequest request)
                            throws org.jboss.shrinkwrap.resolver.api.InvalidConfigurationFileException
Loads Maven configuration and updates session settings accordingly.

Parameters:
request - Request to load settings.xml file
Returns:
Modified session instance
Throws:
org.jboss.shrinkwrap.resolver.api.InvalidConfigurationFileException

execute

Collection<org.sonatype.aether.resolution.ArtifactResult> execute(org.sonatype.aether.collection.CollectRequest request,
                                                                  MavenResolutionFilter filter)
                                                                  throws org.sonatype.aether.resolution.DependencyResolutionException
Throws:
org.sonatype.aether.resolution.DependencyResolutionException

getRemoteRepositories

List<org.sonatype.aether.repository.RemoteRepository> getRemoteRepositories()
                                                                            throws IllegalStateException
Returns a list of remote repositories enabled from Maven settings. If an effective pom was loaded, and it actually contains any repositories, these are added as well.

Returns:
List of currently active repositories
Throws:
IllegalStateException - If currently active repositories cannot be resolved

getModel

org.apache.maven.model.Model getModel()
Returns underlying Maven model for parsed POM file. This is useful when you need to extract additional information from the model.

Returns:
Maven model for parsed POM file.

getSettingsDefinedProfiles

List<org.apache.maven.model.Profile> getSettingsDefinedProfiles()
Gets a list of profiles defined in settings.xml.

Returns:
List of defined profiles

regenerateSession

MavenWorkingSession regenerateSession()
Refreshes underlying Aether session in order to contain newly acquired information, such as new settings.xml content

Returns:
Modified session instance

getArtifactTypeRegistry

org.sonatype.aether.artifact.ArtifactTypeRegistry getArtifactTypeRegistry()
Gets registry of the known artifact types based on underlying session

Returns:
the registry

setOffline

void setOffline(boolean offline)
Whether or not to set this session in "offline" mode

Parameters:
offline -

disableClassPathWorkspaceReader

void disableClassPathWorkspaceReader()
Disables the classpath workspace reader which may be used to resolve from dependencies on the ClassPath


disableMavenCentral

void disableMavenCentral()
Disables use of the Maven Central Repository


ShrinkWrap Resolver Maven Implementation 2.0.0-alpha-2

Copyright © 2012 JBoss by Red Hat. All Rights Reserved.