use of org.commonjava.maven.ext.core.state.XMLState in project pom-manipulation-ext by release-engineering.
the class XMLManipulator method applyChanges.
/**
* Apply the xml changes to the specified file(s).
*/
@Override
public Set<Project> applyChanges(final List<Project> projects) throws ManipulationException {
final XMLState state = session.getState(XMLState.class);
if (!session.isEnabled() || !state.isEnabled()) {
logger.debug(getClass().getSimpleName() + ": Nothing to do!");
return Collections.emptySet();
}
final Set<Project> changed = new HashSet<>();
final List<XMLState.XMLOperation> scripts = state.getXMLOperations();
for (final Project project : projects) {
if (project.isExecutionRoot()) {
for (XMLState.XMLOperation operation : scripts) {
internalApplyChanges(project, operation);
changed.add(project);
}
break;
}
}
return changed;
}
use of org.commonjava.maven.ext.core.state.XMLState in project pom-manipulation-ext by release-engineering.
the class XMLManipulator method init.
/**
* Initialize the {@link XMLState} state holder in the {@link ManipulationSession}. This state holder detects
* 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 XMLState(session.getUserProperties()));
}