Search in sources :

Example 1 with PluginRemovalState

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

the class PluginRemovalManipulator method init.

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

Example 2 with PluginRemovalState

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

the class PluginRemovalManipulator method apply.

private boolean apply(final Project project, final Model model) {
    final PluginRemovalState state = session.getState(PluginRemovalState.class);
    logger.debug("Applying plugin changes to: " + ga(project));
    boolean result = false;
    List<ProjectRef> pluginsToRemove = state.getPluginRemoval();
    if (model.getBuild() != null) {
        result = scanPlugins(pluginsToRemove, model.getBuild().getPlugins());
    }
    for (final Profile profile : ProfileUtils.getProfiles(session, model)) {
        if (profile.getBuild() != null && scanPlugins(pluginsToRemove, profile.getBuild().getPlugins())) {
            result = true;
        }
    }
    return result;
}
Also used : PluginRemovalState(org.commonjava.maven.ext.core.state.PluginRemovalState) SimpleProjectRef(org.commonjava.maven.atlas.ident.ref.SimpleProjectRef) ProjectRef(org.commonjava.maven.atlas.ident.ref.ProjectRef) Profile(org.apache.maven.model.Profile)

Aggregations

PluginRemovalState (org.commonjava.maven.ext.core.state.PluginRemovalState)2 Profile (org.apache.maven.model.Profile)1 ProjectRef (org.commonjava.maven.atlas.ident.ref.ProjectRef)1 SimpleProjectRef (org.commonjava.maven.atlas.ident.ref.SimpleProjectRef)1