Package org.openrewrite.maven
Class MavenExecutionContextView
java.lang.Object
org.openrewrite.DelegatingExecutionContext
org.openrewrite.maven.MavenExecutionContextView
- All Implemented Interfaces:
org.openrewrite.ExecutionContext,org.openrewrite.rpc.RpcCodec<org.openrewrite.ExecutionContext>
public class MavenExecutionContextView
extends org.openrewrite.DelegatingExecutionContext
-
Field Summary
Fields inherited from interface org.openrewrite.ExecutionContext
CURRENT_CYCLE, CURRENT_RECIPE, DATA_TABLES, REQUIRE_PRINT_EQUALS_INPUT, RUN_TIMEOUT, SCANNING_MUTATION_VALIDATION -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable MavenSettingseffectiveSettings(org.openrewrite.maven.tree.MavenResolutionResult mrr) The maven settings in effect are a combination of the settings defined in the context and the settings that were in effect when a given pom was parsed.@Nullable Boolean@Nullable BooleangetCredentials(@Nullable MavenSettings mavenSettings) Get credentials set on this execution context, unless overridden by a supplied maven settings file.getMirrors(@Nullable MavenSettings mavenSettings) Get mirrors set on this execution context, unless overridden by a supplied maven settings file.getRepositories(@Nullable MavenSettings mavenSettings, @Nullable List<String> activeProfiles) Get repositories set on this execution context, unless overridden by a supplied maven settings file.@Nullable MavenSettingsrecordResolutionTime(Duration time) setActiveProfiles(List<String> activeProfiles) setAddCentralRepository(boolean useCentralRepository) setAddLocalRepository(boolean useLocalRepository) setCredentials(Collection<MavenRepositoryCredentials> credentials) setLocalRepository(MavenRepository localRepository) setMavenSettings(@Nullable MavenSettings settings, String... activeProfiles) Replaces the current Maven execution settings with the providedMavenSettings.setMirrors(@Nullable Collection<MavenRepositoryMirror> mirrors) setPinnedSnapshotVersions(Collection<ResolvedGroupArtifactVersion> pinnedSnapshotVersions) Require dependency resolution that encounters a matching group:artifact:version coordinate to resolve to a particular dated snapshot version, effectively making snapshot resolution deterministic.setPomCache(MavenPomCache pomCache) setRepositories(List<MavenRepository> repositories) setResolutionListener(ResolutionEventListener listener) static MavenExecutionContextViewview(org.openrewrite.ExecutionContext ctx) Methods inherited from class org.openrewrite.DelegatingExecutionContext
getDelegate, getMessage, getMessages, getOnError, getOnTimeout, pollMessage, putMessageMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.openrewrite.ExecutionContext
addObserver, computeMessage, computeMessageIfAbsent, getCycle, getCycleDetails, getMessage, getObservers, pollMessage, putCurrentRecipe, putMessageInCollection, putMessageInSet, rpcReceive, rpcSend
-
Constructor Details
-
MavenExecutionContextView
public MavenExecutionContextView(org.openrewrite.ExecutionContext delegate)
-
-
Method Details
-
view
-
recordResolutionTime
-
getResolutionTime
-
setResolutionListener
-
getResolutionListener
-
setMirrors
-
getMirrors
-
getMirrors
Get mirrors set on this execution context, unless overridden by a supplied maven settings file.- Parameters:
mavenSettings- The maven settings defining mirrors to use, if any.- Returns:
- The mirrors to use for dependency resolution.
-
setCredentials
-
getCredentials
-
getCredentials
Get credentials set on this execution context, unless overridden by a supplied maven settings file.- Parameters:
mavenSettings- The maven settings defining credentials (in its server configuration) to use, if any.- Returns:
- The credentials to use for dependency resolution.
-
setPomCache
-
getPomCache
-
setLocalRepository
-
getLocalRepository
-
setAddLocalRepository
-
getAddLocalRepository
-
setAddCentralRepository
-
getAddCentralRepository
-
setRepositories
-
getRepositories
-
getRepositories
public List<MavenRepository> getRepositories(@Nullable MavenSettings mavenSettings, @Nullable List<String> activeProfiles) Get repositories set on this execution context, unless overridden by a supplied maven settings file.- Parameters:
mavenSettings- The maven settings defining repositories to use, if any.activeProfiles- The active profiles to use, if any, with the accompanying maven settings.- Returns:
- The repositories to use for dependency resolution.
-
setPinnedSnapshotVersions
public MavenExecutionContextView setPinnedSnapshotVersions(Collection<ResolvedGroupArtifactVersion> pinnedSnapshotVersions) Require dependency resolution that encounters a matching group:artifact:version coordinate to resolve to a particular dated snapshot version, effectively making snapshot resolution deterministic.- Parameters:
pinnedSnapshotVersions- A set of group:artifact:version and the dated snapshot version to pin them to.
-
getPinnedSnapshotVersions
-
setActiveProfiles
-
getActiveProfiles
-
setMavenSettings
public MavenExecutionContextView setMavenSettings(@Nullable MavenSettings settings, String... activeProfiles) Replaces the current Maven execution settings with the providedMavenSettings.This method does not merge with or preserve any existing configuration. All previously configured repositories, mirrors, credentials, active profiles, and local repository settings will be discarded and replaced entirely with those derived from the given
settings.If
settingsisnull, this call is a no-op and the current configuration remains unchanged.- Parameters:
settings- the Maven settings to apply; ifnull, no changes are madeactiveProfiles- additional active profiles to consider; these are resolved against the provided settings to determine the effective profiles- Returns:
- this execution context view with the updated Maven settings applied
-
getSettings
-
effectiveSettings
public @Nullable MavenSettings effectiveSettings(org.openrewrite.maven.tree.MavenResolutionResult mrr) The maven settings in effect are a combination of the settings defined in the context and the settings that were in effect when a given pom was parsed.
-