Search in sources :

Example 1 with RelocationState

use of org.commonjava.maven.ext.core.state.RelocationState in project pom-manipulation-ext by release-engineering.

the class RelocationManipulator method apply.

private boolean apply(final Project project, final Model model) throws ManipulationException {
    boolean result = false;
    final RelocationState state = session.getState(RelocationState.class);
    final WildcardMap<ProjectVersionRef> relocations = state.getDependencyRelocations();
    logger.debug("Applying relocation changes to: " + ga(project));
    DependencyManagement dependencyManagement = model.getDependencyManagement();
    if (dependencyManagement != null) {
        result = updateDependencies(relocations, project.getResolvedManagedDependencies(session));
    }
    result |= updateDependencies(relocations, project.getAllResolvedDependencies(session));
    for (final Profile profile : ProfileUtils.getProfiles(session, model)) {
        dependencyManagement = profile.getDependencyManagement();
        if (dependencyManagement != null) {
            result |= updateDependencies(relocations, project.getResolvedProfileManagedDependencies(session).get(profile));
        }
        result |= updateDependencies(relocations, project.getAllResolvedProfileDependencies(session).get(profile));
    }
    return result;
}
Also used : RelocationState(org.commonjava.maven.ext.core.state.RelocationState) ProjectVersionRef(org.commonjava.maven.atlas.ident.ref.ProjectVersionRef) DependencyManagement(org.apache.maven.model.DependencyManagement) Profile(org.apache.maven.model.Profile)

Example 2 with RelocationState

use of org.commonjava.maven.ext.core.state.RelocationState in project pom-manipulation-ext by release-engineering.

the class RelocationManipulator method init.

/**
 * Initialize the {@link PluginState} state holder in the {@link ManipulationSession}. This state holder detects
 * relocation configuration from the Maven user properties (-D properties from the CLI) and makes it available for
 * later.
 */
@Override
public void init(final ManipulationSession session) throws ManipulationException {
    this.session = session;
    session.setState(new RelocationState(session.getUserProperties()));
}
Also used : RelocationState(org.commonjava.maven.ext.core.state.RelocationState)

Aggregations

RelocationState (org.commonjava.maven.ext.core.state.RelocationState)2 DependencyManagement (org.apache.maven.model.DependencyManagement)1 Profile (org.apache.maven.model.Profile)1 ProjectVersionRef (org.commonjava.maven.atlas.ident.ref.ProjectVersionRef)1