@Experimental @ThreadSafe public interface Session
| Modifier and Type | Method and Description |
|---|---|
Node |
collectDependencies(Artifact artifact)
Shortcut for
getService(DependencyCollector.class).collect(...) |
Node |
collectDependencies(DependencyCoordinate dependency)
Shortcut for
getService(DependencyResolver.class).resolve(...) |
Node |
collectDependencies(Project project)
Shortcut for
getService(DependencyCollector.class).collect(...) |
Artifact |
createArtifact(String groupId,
String artifactId,
String version,
String extension)
Shortcut for
getService(ArtifactFactory.class).create(...) |
Artifact |
createArtifact(String groupId,
String artifactId,
String version,
String classifier,
String extension,
String type)
Shortcut for
getService(ArtifactFactory.class).create(...) |
ArtifactCoordinate |
createArtifactCoordinate(Artifact artifact)
Shortcut for
getService(ArtifactFactory.class).create(...) |
ArtifactCoordinate |
createArtifactCoordinate(String groupId,
String artifactId,
String version,
String extension)
Shortcut for
getService(ArtifactFactory.class).create(...) |
ArtifactCoordinate |
createArtifactCoordinate(String groupId,
String artifactId,
String version,
String classifier,
String extension,
String type)
Shortcut for
getService(ArtifactFactory.class).create(...) |
DependencyCoordinate |
createDependencyCoordinate(ArtifactCoordinate coordinate)
Shortcut for
getService(DependencyFactory.class).create(...) |
LocalRepository |
createLocalRepository(Path path)
Shortcut for
getService(RepositoryFactory.class).createLocal(...) |
RemoteRepository |
createRemoteRepository(Repository repository)
Shortcut for
getService(RepositoryFactory.class).createRemote(...) |
RemoteRepository |
createRemoteRepository(String id,
String url)
Shortcut for
getService(RepositoryFactory.class).createRemote(...) |
void |
deployArtifact(RemoteRepository repository,
Artifact... artifacts)
Shortcut for
getService(ArtifactDeployer.class).deploy(...) |
Optional<Path> |
getArtifactPath(Artifact artifact)
Shortcut for
getService(ArtifactManager.class).getPath(...) |
SessionData |
getData() |
int |
getDegreeOfConcurrency() |
Path |
getExecutionRootDirectory() |
Collection<Listener> |
getListeners()
Returns the list of registered listeners.
|
LocalRepository |
getLocalRepository() |
String |
getMavenVersion()
Returns the current maven version
|
Path |
getMultiModuleProjectDirectory() |
Path |
getPathForLocalArtifact(Artifact artifact) |
Path |
getPathForRemoteArtifact(RemoteRepository remote,
Artifact artifact) |
Map<String,Object> |
getPluginContext(Project project)
Returns the plugin context for mojo being executed and the specified
Project, never returns null as if context not present, creates it. |
List<Project> |
getProjects() |
List<RemoteRepository> |
getRemoteRepositories() |
<T extends Service> |
getService(Class<T> clazz)
Retrieves the service for the interface
|
Settings |
getSettings() |
Instant |
getStartTime() |
Map<String,String> |
getSystemProperties() |
Map<String,String> |
getUserProperties() |
void |
installArtifacts(Artifact... artifacts)
Shortcut for
getService(ArtifactInstaller.class).install(...) |
void |
installArtifacts(Collection<Artifact> artifacts)
Shortcut for
getService(ArtifactInstaller.class).install(...) |
boolean |
isVersionSnapshot(String version)
Shortcut for
getService(ArtifactManager.class).isSnapshot(...) |
Version |
parseVersion(String version)
Shortcut for
getService(VersionParser.class).parseVersion(...) |
VersionRange |
parseVersionRange(String versionRange)
Shortcut for
getService(VersionParser.class).parseVersionRange(...) |
void |
registerListener(Listener listener)
Register the given listener which will receive all events.
|
Artifact |
resolveArtifact(Artifact artifact)
Shortcut for
getService(ArtifactResolver.class).resolve(...) |
Artifact |
resolveArtifact(ArtifactCoordinate coordinate)
Shortcut for
getService(ArtifactResolver.class).resolve(...) |
Collection<Artifact> |
resolveArtifacts(Artifact... artifacts)
Shortcut for
getService(ArtifactResolver.class).resolve(...) |
Collection<Artifact> |
resolveArtifacts(ArtifactCoordinate... coordinates)
Shortcut for
getService(ArtifactResolver.class).resolve(...) |
Collection<Artifact> |
resolveArtifacts(Collection<? extends ArtifactCoordinate> coordinates)
Shortcut for
getService(ArtifactResolver.class).resolve(...) |
void |
setArtifactPath(Artifact artifact,
Path path)
Shortcut for
getService(ArtifactManager.class).setPath(...) |
void |
unregisterListener(Listener listener)
Unregisters a previously registered listener.
|
Session |
withLocalRepository(LocalRepository localRepository)
Creates a derived session using the given local repository.
|
Session |
withRemoteRepositories(List<RemoteRepository> repositories)
Creates a derived session using the given remote repositories.
|
@Nonnull LocalRepository getLocalRepository()
@Nonnull List<RemoteRepository> getRemoteRepositories()
@Nonnull SessionData getData()
@Nonnull String getMavenVersion()
null.int getDegreeOfConcurrency()
@Nonnull Map<String,Object> getPluginContext(@Nonnull Project project)
Project, never returns null as if context not present, creates it.
Implementation note: while this method return type is Map, the returned map instance
implements ConcurrentMap as well.MavenException - if not called from the within a mojo execution@Nonnull <T extends Service> T getService(@Nonnull Class<T> clazz)
NoSuchElementException - if the service could not be found@Nonnull Session withLocalRepository(@Nonnull LocalRepository localRepository)
localRepository - the new local repositoryNullPointerException - if localRepository is null@Nonnull Session withRemoteRepositories(@Nonnull List<RemoteRepository> repositories)
repositories - the new list of remote repositoriesNullPointerException - if repositories is nullvoid registerListener(@Nonnull Listener listener)
listener - the listener to registerNullPointerException - if listener is nullvoid unregisterListener(@Nonnull Listener listener)
listener - the listener to unregisterNullPointerException - if listener is null@Nonnull Collection<Listener> getListeners()
nullLocalRepository createLocalRepository(Path path)
getService(RepositoryFactory.class).createLocal(...)RepositoryFactory.createLocal(Path)@Nonnull RemoteRepository createRemoteRepository(@Nonnull String id, @Nonnull String url)
getService(RepositoryFactory.class).createRemote(...)@Nonnull RemoteRepository createRemoteRepository(@Nonnull Repository repository)
getService(RepositoryFactory.class).createRemote(...)ArtifactCoordinate createArtifactCoordinate(String groupId, String artifactId, String version, String extension)
getService(ArtifactFactory.class).create(...)ArtifactCoordinate createArtifactCoordinate(String groupId, String artifactId, String version, String classifier, String extension, String type)
getService(ArtifactFactory.class).create(...)ArtifactCoordinate createArtifactCoordinate(Artifact artifact)
getService(ArtifactFactory.class).create(...)@Nonnull DependencyCoordinate createDependencyCoordinate(@Nonnull ArtifactCoordinate coordinate)
getService(DependencyFactory.class).create(...)Artifact createArtifact(String groupId, String artifactId, String version, String extension)
getService(ArtifactFactory.class).create(...)Artifact createArtifact(String groupId, String artifactId, String version, String classifier, String extension, String type)
getService(ArtifactFactory.class).create(...)Artifact resolveArtifact(ArtifactCoordinate coordinate)
getService(ArtifactResolver.class).resolve(...)ArtifactResolverException - if the artifact resolution failedArtifactResolver.resolve(Session, Collection)Collection<Artifact> resolveArtifacts(ArtifactCoordinate... coordinates)
getService(ArtifactResolver.class).resolve(...)ArtifactResolverException - if the artifact resolution failedArtifactResolver.resolve(Session, Collection)Collection<Artifact> resolveArtifacts(Collection<? extends ArtifactCoordinate> coordinates)
getService(ArtifactResolver.class).resolve(...)ArtifactResolverException - if the artifact resolution failedArtifactResolver.resolve(Session, Collection)Artifact resolveArtifact(Artifact artifact)
getService(ArtifactResolver.class).resolve(...)ArtifactResolverException - if the artifact resolution failedArtifactResolver.resolve(Session, Collection)Collection<Artifact> resolveArtifacts(Artifact... artifacts)
getService(ArtifactResolver.class).resolve(...)ArtifactResolverException - if the artifact resolution failedArtifactResolver.resolve(Session, Collection)void installArtifacts(Artifact... artifacts)
getService(ArtifactInstaller.class).install(...)ArtifactInstallerException - if the artifacts installation failedArtifactInstaller.install(Session, Collection)void installArtifacts(Collection<Artifact> artifacts)
getService(ArtifactInstaller.class).install(...)ArtifactInstallerException - if the artifacts installation failedArtifactInstaller.install(Session, Collection)void deployArtifact(RemoteRepository repository, Artifact... artifacts)
getService(ArtifactDeployer.class).deploy(...)ArtifactDeployerException - if the artifacts deployment failedArtifactDeployer.deploy(Session, RemoteRepository, Collection)void setArtifactPath(@Nonnull Artifact artifact, @Nonnull Path path)
getService(ArtifactManager.class).setPath(...)ArtifactManager.setPath(Artifact, Path)@Nonnull Optional<Path> getArtifactPath(@Nonnull Artifact artifact)
getService(ArtifactManager.class).getPath(...)ArtifactManager.getPath(Artifact)boolean isVersionSnapshot(@Nonnull String version)
getService(ArtifactManager.class).isSnapshot(...)VersionParser.isSnapshot(String)@Nonnull Node collectDependencies(@Nonnull Artifact artifact)
getService(DependencyCollector.class).collect(...)DependencyCollectorException - if the dependency collection failedDependencyCollector.collect(Session, Artifact)@Nonnull Node collectDependencies(@Nonnull Project project)
getService(DependencyCollector.class).collect(...)DependencyCollectorException - if the dependency collection failedDependencyCollector.collect(Session, Project)@Nonnull Node collectDependencies(@Nonnull DependencyCoordinate dependency)
getService(DependencyResolver.class).resolve(...)DependencyCollectorException - if the dependency collection failedDependencyCollector.collect(Session, DependencyCoordinate)Path getPathForRemoteArtifact(RemoteRepository remote, Artifact artifact)
@Nonnull Version parseVersion(@Nonnull String version)
getService(VersionParser.class).parseVersion(...)VersionParserException - if the parsing failedVersionParser.parseVersion(String)@Nonnull VersionRange parseVersionRange(@Nonnull String versionRange)
getService(VersionParser.class).parseVersionRange(...)VersionParserException - if the parsing failedVersionParser.parseVersionRange(String)Copyright © 2001–2022 The Apache Software Foundation. All rights reserved.