dependencies = ofNullable(model.getDependencies()).orElse(new ArrayList<>());
+ dependencies.addAll(ofNullable(model.getProfiles())
+ .flatMap(profiles -> profiles.stream()
+ .map(ModelBase::getDependencies)
+ .reduce((l1, l2) -> {
+ l1.addAll(l2);
+ return l1;
+ }))
+ .orElse(emptyList()));
+ return dependencies;
+ }
+
+ /**
+ * Will process the given module tree node, updating the {@link ModifiedPomXMLEventReader} associated with the
+ * node if it finds a dependency matching the filter that needs to be changed or, if {@link #processProperties}
+ * is {@code true}, a property value that can be updated.
+ * The method will use the set passed as the {@code backlog} argument to store the properties which it needs
+ * to update, but which were not found in the current tree. These properties need to be carried over to the parent
+ * node for processing.
+ * Similarly, method will use the map passed as the {@code propertyConflicts} argument to store properties
+ * which are associated with dependencies which do not fit the filter and thus may not be changed. This is then
+ * used for conflict detection if a dependency to be changed used one of these properties. Such a change
+ * is not allowed and must be reported instead.
+ *
+ * @param node model tree node to process
+ * @param dependencies collection of dependencies to process (can be taken from dependency management,
+ * parent, or dependencies)
+ * @param changeKind {@link ChangeRecord.ChangeKind} instance for the change recorder
+ * @param propertyBacklog a {@link Set} instance used to store dependencies to be updated, but which were not found
+ * in the current subtree. These properties need to be carried over to the parent node for
+ * processing.
+ * @param propertyConflicts an {@link Map} instance to store properties
+ * which are associated with dependencies which do not fit the filter and thus may not
+ * be changed. This is then used for conflict detection if a dependency to be changed
+ * used one of these properties. Such a change is not allowed and must be reported instead.
+ * @throws MojoExecutionException thrown if a version may not be changed
+ * @throws XMLStreamException thrown if a {@link ModifiedPomXMLEventReader} can't be updated
+ * @throws VersionRetrievalException thrown if dependency versions cannot be retrieved
+ */
private void useDepVersion(
- ModifiedPomXMLEventReader pom, Collection dependencies, ChangeRecord.ChangeKind changeKind)
+ ModelNode node,
+ Collection dependencies,
+ ChangeRecord.ChangeKind changeKind,
+ Set propertyBacklog,
+ Map> propertyConflicts)
throws MojoExecutionException, XMLStreamException, VersionRetrievalException {
+ // an additional pass is necessary to collect conflicts if processProperties is enabled
+ if (processProperties) {
+ dependencies.stream()
+ .filter(dep -> {
+ try {
+ return !isIncluded(toArtifact(dep));
+ } catch (MojoExecutionException e) {
+ throw new RuntimeException(e);
+ }
+ })
+ .forEach(dep ->
+ // if a dependency that is _not_ to be changed is set using a property, register that
+ // property
+ // in propertyConflicts; these are the properties that must not be changed
+ // the list in the value is the list of dependencies that use the said property
+ PomHelper.extractExpression(dep.getVersion())
+ .ifPresent(p -> propertyConflicts.compute(p, (k, v) -> ofNullable(v)
+ .map(set -> {
+ set.add(dep);
+ return set;
+ })
+ .orElseGet(() -> {
+ Set set = new TreeSet<>(DependencyComparator.INSTANCE);
+ set.add(dep);
+ return set;
+ }))));
+ }
+
+ // 2nd pass: check dependencies
for (Dependency dep : dependencies) {
if (isExcludeReactor() && isProducedByReactor(dep)) {
- getLog().info("Ignoring reactor dependency: " + toString(dep));
+ getLog().info("Ignoring a reactor dependency: " + toString(dep));
continue;
}
- if (isHandledByProperty(dep)) {
- getLog().debug("Ignoring dependency with property as version: " + toString(dep));
+ Optional propertyName = PomHelper.extractExpression(dep.getVersion());
+ if (propertyName.isPresent() && !processProperties) {
+ getLog().info("Ignoring a dependency with the version set using a property: " + toString(dep));
continue;
}
- Artifact artifact = this.toArtifact(dep);
-
+ Artifact artifact = toArtifact(dep);
if (isIncluded(artifact)) {
if (!forceVersion) {
- ArtifactVersions versions = getHelper().lookupArtifactVersions(artifact, false);
-
- if (!versions.containsVersion(depVersion)) {
+ if (!getHelper().lookupArtifactVersions(artifact, false).containsVersion(depVersion)) {
throw new MojoExecutionException(String.format(
"Version %s is not available for artifact %s:%s",
depVersion, artifact.getGroupId(), artifact.getArtifactId()));
}
}
- updateDependencyVersion(pom, dep, depVersion, changeKind);
+ if (!propertyName.isPresent()) {
+ updateDependencyVersion(node.getModifiedPomXMLEventReader(), dep, depVersion, changeKind);
+ } else {
+ // propertyName is present
+ ofNullable(propertyConflicts.get(propertyName.get()))
+ .map(conflict -> {
+ getLog().warn("Cannot update property ${" + propertyName.get() + "}: "
+ + "controls more than one dependency: "
+ + conflict.stream()
+ .map(Dependency::getArtifactId)
+ .collect(Collectors.joining(", ")));
+ return false;
+ })
+ .orElseGet(() -> {
+ if (!updatePropertyValue(node, propertyName.get())) {
+ propertyBacklog.add(propertyName.get());
+ } else {
+ if (getLog().isDebugEnabled()) {
+ getLog().debug(String.format(
+ "Updated the %s property value to %s.", dep.getVersion(), depVersion));
+ }
+ }
+ return true;
+ });
+ }
}
}
+
+ // third pass: if a property is defined at this node, it is not going to conflict with anything from parent
+ propertyConflicts.keySet().removeIf(key -> ofNullable(node.getModel().getProperties())
+ .filter(p -> p.containsKey(key))
+ .isPresent());
+ propertyConflicts.keySet().removeIf(key -> ofNullable(node.getModel().getProfiles())
+ .map(list -> list.stream().anyMatch(p -> ofNullable(p.getProperties())
+ .filter(prop -> prop.containsKey(key))
+ .isPresent()))
+ .orElse(false));
+ }
+
+ private boolean updatePropertyValue(ModelNode node, String property) {
+ return ofNullable(node.getModel().getProperties())
+ .filter(p -> p.containsKey(property))
+ .map(ignored -> {
+ try {
+ return PomHelper.setPropertyVersion(
+ node.getModifiedPomXMLEventReader(), null, property, depVersion);
+ } catch (XMLStreamException e) {
+ throw new RuntimeException(e);
+ }
+ })
+ .orElse(false)
+ | ofNullable(node.getModel().getProfiles())
+ .flatMap(profiles -> profiles.stream()
+ .map(profile -> ofNullable(profile.getProperties())
+ .filter(p -> p.containsKey(property))
+ .map(ignored -> {
+ try {
+ return PomHelper.setPropertyVersion(
+ node.getModifiedPomXMLEventReader(),
+ profile.getId(),
+ property,
+ depVersion);
+ } catch (XMLStreamException e) {
+ throw new RuntimeException(e);
+ }
+ })
+ .orElse(false))
+ .reduce(Boolean::logicalOr))
+ .orElse(false);
}
}
diff --git a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/UseDepVersionMojoTest.java b/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/UseDepVersionMojoTest.java
index 31c04aa7cb..f1aaf8bf0d 100644
--- a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/UseDepVersionMojoTest.java
+++ b/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/UseDepVersionMojoTest.java
@@ -19,14 +19,31 @@
* under the License.
*/
-import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
import java.util.Collections;
+import org.apache.maven.plugin.logging.Log;
+import org.apache.maven.plugin.logging.SystemStreamLog;
import org.apache.maven.plugin.testing.AbstractMojoTestCase;
import org.apache.maven.plugin.testing.MojoRule;
+import org.codehaus.mojo.versions.utils.TestChangeRecorder;
+import org.codehaus.mojo.versions.utils.TestUtils;
+import org.junit.After;
+import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
+import static org.codehaus.mojo.versions.utils.MockUtils.mockAetherRepositorySystem;
+import static org.codehaus.mojo.versions.utils.MockUtils.mockRepositorySystem;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.containsString;
+import static org.hamcrest.Matchers.empty;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.mock;
+
/**
* Basic tests for {@linkplain UseDepVersionMojo}.
*
@@ -36,16 +53,275 @@ public class UseDepVersionMojoTest extends AbstractMojoTestCase {
@Rule
public MojoRule mojoRule = new MojoRule(this);
+ private Path tempDir;
+
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+ tempDir = TestUtils.createTempDir("use-dep-version");
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ try {
+ TestUtils.tearDownTempDir(tempDir);
+ } finally {
+ super.tearDown();
+ }
+ }
+
@Test
public void testIssue673() throws Exception {
- UseDepVersionMojo mojo = (UseDepVersionMojo) mojoRule.lookupConfiguredMojo(
- new File("target/test-classes/org/codehaus/mojo/use-dep-version/issue-637"), "use-dep-version");
- setVariableValueToObject(mojo, "processDependencies", true);
- setVariableValueToObject(mojo, "processDependencyManagement", true);
- setVariableValueToObject(mojo, "excludeReactor", true);
+ TestUtils.copyDir(Paths.get("src/test/resources/org/codehaus/mojo/use-dep-version/issue-637"), tempDir);
+ UseDepVersionMojo mojo = (UseDepVersionMojo) mojoRule.lookupConfiguredMojo(tempDir.toFile(), "use-dep-version");
setVariableValueToObject(mojo, "serverId", "serverId");
setVariableValueToObject(mojo, "reactorProjects", Collections.singletonList(mojo.getProject()));
mojo.execute();
}
+
+ /**
+ * Tests a simple case with a single property: the property value needs to be changed.
+ * @throws Exception thrown if something goes not according to plan
+ */
+ @Test
+ public void testPropertiesSimple() throws Exception {
+ Log logger = new SystemStreamLog() {
+ @Override
+ public boolean isDebugEnabled() {
+ return true;
+ }
+ };
+ TestUtils.copyDir(Paths.get("src/test/resources/org/codehaus/mojo/use-dep-version/properties/simple"), tempDir);
+ TestChangeRecorder changeRecorder = new TestChangeRecorder();
+ UseDepVersionMojo mojo = (UseDepVersionMojo) mojoRule.lookupConfiguredMojo(tempDir.toFile(), "use-dep-version");
+ setVariableValueToObject(mojo, "reactorProjects", Collections.singletonList(mojo.getProject()));
+ setVariableValueToObject(mojo, "repositorySystem", mockRepositorySystem());
+ setVariableValueToObject(mojo, "aetherRepositorySystem", mockAetherRepositorySystem());
+ setVariableValueToObject(mojo, "log", logger);
+
+ mojo.execute();
+
+ String pom = String.join("", Files.readAllLines(tempDir.resolve("pom.xml")));
+ assertThat(pom, containsString("${revision}"));
+ assertThat(pom, containsString("2.0.0"));
+ }
+
+ /**
+ * The same as {@link #testPropertiesSimple()}, but with profiles.
+ * @throws Exception thrown if something goes not according to plan
+ */
+ @Test
+ public void testPropertiesSimpleProfiles() throws Exception {
+ Log logger = new SystemStreamLog() {
+ @Override
+ public boolean isDebugEnabled() {
+ return true;
+ }
+ };
+ TestUtils.copyDir(
+ Paths.get("src/test/resources/org/codehaus/mojo/use-dep-version/properties/simple-profiles"), tempDir);
+ TestChangeRecorder changeRecorder = new TestChangeRecorder();
+ UseDepVersionMojo mojo = (UseDepVersionMojo) mojoRule.lookupConfiguredMojo(tempDir.toFile(), "use-dep-version");
+ setVariableValueToObject(mojo, "reactorProjects", Collections.singletonList(mojo.getProject()));
+ setVariableValueToObject(mojo, "repositorySystem", mockRepositorySystem());
+ setVariableValueToObject(mojo, "aetherRepositorySystem", mockAetherRepositorySystem());
+ setVariableValueToObject(mojo, "log", logger);
+
+ mojo.execute();
+
+ String pom = String.join("", Files.readAllLines(tempDir.resolve("pom.xml")));
+ assertThat(pom, containsString("${revision}"));
+ assertThat(pom, containsString("2.0.0"));
+ }
+
+ /**
+ * Tests a case with a single property used for more than one dependency, of which only one is to be changed:
+ * the property value must remain unchanged, and a warning must be logged.
+ * @throws Exception thrown if something goes not according to plan
+ */
+ @Test
+ public void testPropertiesConflict() throws Exception {
+ Log logger = mock(Log.class);
+ StringBuilder warnLog = new StringBuilder();
+ doAnswer(i -> warnLog.append(i.getArgument(0).toString())).when(logger).warn(anyString());
+ TestChangeRecorder changeRecorder = new TestChangeRecorder();
+
+ TestUtils.copyDir(
+ Paths.get("src/test/resources/org/codehaus/mojo/use-dep-version/properties/conflict"), tempDir);
+ UseDepVersionMojo mojo = (UseDepVersionMojo) mojoRule.lookupConfiguredMojo(tempDir.toFile(), "use-dep-version");
+ setVariableValueToObject(mojo, "reactorProjects", Collections.singletonList(mojo.getProject()));
+ setVariableValueToObject(mojo, "repositorySystem", mockRepositorySystem());
+ setVariableValueToObject(mojo, "aetherRepositorySystem", mockAetherRepositorySystem());
+ setVariableValueToObject(mojo, "changeRecorders", changeRecorder.asTestMap());
+ setVariableValueToObject(mojo, "log", logger);
+
+ mojo.execute();
+
+ assertThat(changeRecorder.getChanges(), empty());
+ assertThat(
+ warnLog.toString(),
+ containsString("Cannot update property ${revision}: controls more than one dependency: artifactB"));
+ }
+
+ /**
+ * Tests a case with a single property used for more than one dependency, of which only one is to be changed:
+ * however, the other dependency (not to be changed) uses the redefined value of the property.
+ * In this case, the change should take place in the child, but not in the parent.
+ * @throws Exception thrown if something goes not according to plan
+ */
+ @Test
+ public void testPropertiesConflictRedefinition() throws Exception {
+ TestUtils.copyDir(
+ Paths.get("src/test/resources/org/codehaus/mojo/use-dep-version/properties/conflict-redefinition"),
+ tempDir);
+ UseDepVersionMojo mojo = (UseDepVersionMojo) mojoRule.lookupConfiguredMojo(tempDir.toFile(), "use-dep-version");
+ setVariableValueToObject(mojo, "reactorProjects", Collections.singletonList(mojo.getProject()));
+ setVariableValueToObject(mojo, "repositorySystem", mockRepositorySystem());
+ setVariableValueToObject(mojo, "aetherRepositorySystem", mockAetherRepositorySystem());
+
+ mojo.execute();
+
+ String child = String.join("", Files.readAllLines(tempDir.resolve("child/pom.xml")));
+ String parent = String.join("", Files.readAllLines(tempDir.resolve("pom.xml")));
+ assertThat(child, containsString("${revision}"));
+ assertThat(parent, containsString("${revision}"));
+ assertThat(child, containsString("2.0.0"));
+ assertThat(parent, containsString("1.0.0-SNAPSHOT"));
+ }
+
+ /**
+ * Tests a case with a single property used for more than one dependency, of which only one is to be changed:
+ * the dependency to be changed is in the parent, and both the child and the parent redefine the same property.
+ * Because the property is redefined at the child level, the child is immune to property changes, hence
+ * the substitution must take place.
+ * @throws Exception thrown if something goes not according to plan
+ */
+ @Test
+ public void testPropertiesConflictCancellation() throws Exception {
+ TestUtils.copyDir(
+ Paths.get("src/test/resources/org/codehaus/mojo/use-dep-version/properties/conflict-cancellation"),
+ tempDir);
+ UseDepVersionMojo mojo = (UseDepVersionMojo) mojoRule.lookupConfiguredMojo(tempDir.toFile(), "use-dep-version");
+ setVariableValueToObject(mojo, "reactorProjects", Collections.singletonList(mojo.getProject()));
+ setVariableValueToObject(mojo, "repositorySystem", mockRepositorySystem());
+ setVariableValueToObject(mojo, "aetherRepositorySystem", mockAetherRepositorySystem());
+
+ mojo.execute();
+
+ String child = String.join("", Files.readAllLines(tempDir.resolve("child/pom.xml")));
+ String parent = String.join("", Files.readAllLines(tempDir.resolve("pom.xml")));
+ assertThat(child, containsString("${revision}"));
+ assertThat(parent, containsString("${revision}"));
+ assertThat(parent, containsString("2.0.0"));
+ assertThat(child, containsString("1.0.1"));
+ }
+
+ /**
+ * The same as {@link #testPropertiesConflictCancellation()}, but working on profiles.
+ * @throws Exception thrown if something goes not according to plan
+ */
+ @Test
+ public void testPropertiesConflictCancellationProfiles() throws Exception {
+ TestUtils.copyDir(
+ Paths.get("src/test/resources/org/codehaus/mojo/use-dep-version/properties/"
+ + "conflict-cancellation-profiles"),
+ tempDir);
+ UseDepVersionMojo mojo = (UseDepVersionMojo) mojoRule.lookupConfiguredMojo(tempDir.toFile(), "use-dep-version");
+ setVariableValueToObject(mojo, "reactorProjects", Collections.singletonList(mojo.getProject()));
+ setVariableValueToObject(mojo, "repositorySystem", mockRepositorySystem());
+ setVariableValueToObject(mojo, "aetherRepositorySystem", mockAetherRepositorySystem());
+
+ mojo.execute();
+
+ String child = String.join("", Files.readAllLines(tempDir.resolve("child/pom.xml")));
+ String parent = String.join("", Files.readAllLines(tempDir.resolve("pom.xml")));
+ assertThat(child, containsString("${revision}"));
+ assertThat(parent, containsString("${revision}"));
+ assertThat(parent, containsString("2.0.0"));
+ assertThat(child, containsString("1.0.1"));
+ }
+
+ /**
+ * Tests a case with a single property defined in the parent, and used in the child: the property value in
+ * the parent needs to be updated.
+ * @throws Exception thrown if something goes not according to plan
+ */
+ @Test
+ public void testPropertiesChildParent() throws Exception {
+ Log logger = new SystemStreamLog() {
+ @Override
+ public boolean isDebugEnabled() {
+ return true;
+ }
+ };
+ TestUtils.copyDir(
+ Paths.get("src/test/resources/org/codehaus/mojo/use-dep-version/properties/child-parent"), tempDir);
+ UseDepVersionMojo mojo = (UseDepVersionMojo) mojoRule.lookupConfiguredMojo(tempDir.toFile(), "use-dep-version");
+ setVariableValueToObject(mojo, "reactorProjects", Collections.singletonList(mojo.getProject()));
+ setVariableValueToObject(mojo, "repositorySystem", mockRepositorySystem());
+ setVariableValueToObject(mojo, "aetherRepositorySystem", mockAetherRepositorySystem());
+ setVariableValueToObject(mojo, "log", logger);
+
+ mojo.execute();
+
+ String child = String.join("", Files.readAllLines(tempDir.resolve("child/pom.xml")));
+ String parent = String.join("", Files.readAllLines(tempDir.resolve("pom.xml")));
+ assertThat(child, containsString("${revision}"));
+ assertThat(parent, containsString("2.0.0"));
+ }
+
+ /**
+ * Tests a case with a single property defined in the parent and then redefined in the child: the property
+ * must be redefined in the child and remain the same in the parent.
+ * @throws Exception thrown if something goes not according to plan
+ */
+ @Test
+ public void testPropertiesChildParentRedefinition() throws Exception {
+ TestUtils.copyDir(
+ Paths.get("src/test/resources/org/codehaus/mojo/use-dep-version/properties/child-parent-redefinition"),
+ tempDir);
+ UseDepVersionMojo mojo = (UseDepVersionMojo) mojoRule.lookupConfiguredMojo(tempDir.toFile(), "use-dep-version");
+ setVariableValueToObject(mojo, "reactorProjects", Collections.singletonList(mojo.getProject()));
+ setVariableValueToObject(mojo, "repositorySystem", mockRepositorySystem());
+ setVariableValueToObject(mojo, "aetherRepositorySystem", mockAetherRepositorySystem());
+
+ mojo.execute();
+
+ String child = String.join("", Files.readAllLines(tempDir.resolve("child/pom.xml")));
+ String parent = String.join("", Files.readAllLines(tempDir.resolve("pom.xml")));
+ assertThat(child, containsString("${revision}"));
+ assertThat(parent, containsString("1.0.0-SNAPSHOT"));
+ assertThat(child, containsString("2.0.0"));
+ }
+
+ /**
+ * Tests a case with a single property defined in the parent: a warning must be logged and no files must
+ * be changed.
+ * @throws Exception thrown if something goes not according to plan
+ */
+ @Test
+ public void testPropertyFromParent() throws Exception {
+ Log logger = mock(Log.class);
+ StringBuilder log = new StringBuilder();
+ doAnswer(i -> log.append("[WARN] ").append(i.getArgument(0).toString()))
+ .when(logger)
+ .warn(anyString());
+ TestChangeRecorder changeRecorder = new TestChangeRecorder();
+
+ TestUtils.copyDir(
+ Paths.get("src/test/resources/org/codehaus/mojo/use-dep-version/properties/child-parent"), tempDir);
+ UseDepVersionMojo mojo = (UseDepVersionMojo)
+ mojoRule.lookupConfiguredMojo(tempDir.resolve("child").toFile(), "use-dep-version");
+ setVariableValueToObject(mojo, "reactorProjects", Collections.singletonList(mojo.getProject()));
+ setVariableValueToObject(mojo, "repositorySystem", mockRepositorySystem());
+ setVariableValueToObject(mojo, "aetherRepositorySystem", mockAetherRepositorySystem());
+ setVariableValueToObject(mojo, "changeRecorders", changeRecorder.asTestMap());
+ setVariableValueToObject(mojo, "log", logger);
+
+ mojo.execute();
+
+ assertThat(changeRecorder.getChanges(), empty());
+ assertThat(log.toString(), containsString("[WARN] Not updating property ${revision}: defined in parent"));
+ }
}
diff --git a/versions-maven-plugin/src/test/resources/org/codehaus/mojo/use-dep-version/properties/child-parent-redefinition/child/pom.xml b/versions-maven-plugin/src/test/resources/org/codehaus/mojo/use-dep-version/properties/child-parent-redefinition/child/pom.xml
new file mode 100644
index 0000000000..417a2aec32
--- /dev/null
+++ b/versions-maven-plugin/src/test/resources/org/codehaus/mojo/use-dep-version/properties/child-parent-redefinition/child/pom.xml
@@ -0,0 +1,26 @@
+
+
+ 4.0.0
+
+
+ test-group
+ parent
+ 1.0.0
+
+
+ child
+ 1.0.0
+
+
+ 1.0.1
+
+
+
+
+ test-group
+ artifactA
+ ${revision}
+
+
+
+
diff --git a/versions-maven-plugin/src/test/resources/org/codehaus/mojo/use-dep-version/properties/child-parent-redefinition/pom.xml b/versions-maven-plugin/src/test/resources/org/codehaus/mojo/use-dep-version/properties/child-parent-redefinition/pom.xml
new file mode 100644
index 0000000000..8cfde5786d
--- /dev/null
+++ b/versions-maven-plugin/src/test/resources/org/codehaus/mojo/use-dep-version/properties/child-parent-redefinition/pom.xml
@@ -0,0 +1,33 @@
+
+
+ 4.0.0
+
+ test-group
+ parent
+ 1.0.0
+ pom
+
+
+ 1.0.0-SNAPSHOT
+
+
+
+ child
+
+
+
+
+
+ org.codehaus.mojo
+ versions-maven-plugin
+
+ test-group
+ 2.0.0
+ false
+ true
+
+
+
+
+
+
diff --git a/versions-maven-plugin/src/test/resources/org/codehaus/mojo/use-dep-version/properties/child-parent/child/pom.xml b/versions-maven-plugin/src/test/resources/org/codehaus/mojo/use-dep-version/properties/child-parent/child/pom.xml
new file mode 100644
index 0000000000..4e5aa17905
--- /dev/null
+++ b/versions-maven-plugin/src/test/resources/org/codehaus/mojo/use-dep-version/properties/child-parent/child/pom.xml
@@ -0,0 +1,22 @@
+
+
+ 4.0.0
+
+
+ test-group
+ parent
+ 1.0.0
+
+
+ child
+ 1.0.0
+
+
+
+ test-group
+ artifactA
+ ${revision}
+
+
+
+
diff --git a/versions-maven-plugin/src/test/resources/org/codehaus/mojo/use-dep-version/properties/child-parent/pom.xml b/versions-maven-plugin/src/test/resources/org/codehaus/mojo/use-dep-version/properties/child-parent/pom.xml
new file mode 100644
index 0000000000..d137a888b9
--- /dev/null
+++ b/versions-maven-plugin/src/test/resources/org/codehaus/mojo/use-dep-version/properties/child-parent/pom.xml
@@ -0,0 +1,33 @@
+
+
+ 4.0.0
+
+ test-group
+ parent
+ 1.0.0
+ pom
+
+
+ 1.0.0
+
+
+
+ child
+
+
+
+
+
+ org.codehaus.mojo
+ versions-maven-plugin
+
+ test-group
+ 2.0.0
+ false
+ true
+
+
+
+
+
+
diff --git a/versions-maven-plugin/src/test/resources/org/codehaus/mojo/use-dep-version/properties/conflict-cancellation-profiles/child/pom.xml b/versions-maven-plugin/src/test/resources/org/codehaus/mojo/use-dep-version/properties/conflict-cancellation-profiles/child/pom.xml
new file mode 100644
index 0000000000..417a2aec32
--- /dev/null
+++ b/versions-maven-plugin/src/test/resources/org/codehaus/mojo/use-dep-version/properties/conflict-cancellation-profiles/child/pom.xml
@@ -0,0 +1,26 @@
+
+
+ 4.0.0
+
+
+ test-group
+ parent
+ 1.0.0
+
+
+ child
+ 1.0.0
+
+
+ 1.0.1
+
+
+
+
+ test-group
+ artifactA
+ ${revision}
+
+
+
+
diff --git a/versions-maven-plugin/src/test/resources/org/codehaus/mojo/use-dep-version/properties/conflict-cancellation-profiles/pom.xml b/versions-maven-plugin/src/test/resources/org/codehaus/mojo/use-dep-version/properties/conflict-cancellation-profiles/pom.xml
new file mode 100644
index 0000000000..87da098596
--- /dev/null
+++ b/versions-maven-plugin/src/test/resources/org/codehaus/mojo/use-dep-version/properties/conflict-cancellation-profiles/pom.xml
@@ -0,0 +1,50 @@
+
+
+ 4.0.0
+
+ test-group
+ parent
+ 1.0.0
+ pom
+
+
+ child
+
+
+
+
+ test-profile
+
+ true
+
+
+ 1.0.0-SNAPSHOT
+
+
+
+ test-group
+ artifactB
+ ${revision}
+
+
+
+
+
+
+
+
+ org.codehaus.mojo
+ versions-maven-plugin
+
+ test-group:artifactB
+ 2.0.0
+ false
+ true
+
+ true
+
+
+
+
+
+
diff --git a/versions-maven-plugin/src/test/resources/org/codehaus/mojo/use-dep-version/properties/conflict-cancellation/child/pom.xml b/versions-maven-plugin/src/test/resources/org/codehaus/mojo/use-dep-version/properties/conflict-cancellation/child/pom.xml
new file mode 100644
index 0000000000..417a2aec32
--- /dev/null
+++ b/versions-maven-plugin/src/test/resources/org/codehaus/mojo/use-dep-version/properties/conflict-cancellation/child/pom.xml
@@ -0,0 +1,26 @@
+
+
+ 4.0.0
+
+
+ test-group
+ parent
+ 1.0.0
+
+
+ child
+ 1.0.0
+
+
+ 1.0.1
+
+
+
+
+ test-group
+ artifactA
+ ${revision}
+
+
+
+
diff --git a/versions-maven-plugin/src/test/resources/org/codehaus/mojo/use-dep-version/properties/conflict-cancellation/pom.xml b/versions-maven-plugin/src/test/resources/org/codehaus/mojo/use-dep-version/properties/conflict-cancellation/pom.xml
new file mode 100644
index 0000000000..279fe3acb8
--- /dev/null
+++ b/versions-maven-plugin/src/test/resources/org/codehaus/mojo/use-dep-version/properties/conflict-cancellation/pom.xml
@@ -0,0 +1,43 @@
+
+
+ 4.0.0
+
+ test-group
+ parent
+ 1.0.0
+ pom
+
+
+ 1.0.0-SNAPSHOT
+
+
+
+ child
+
+
+
+
+ test-group
+ artifactB
+ ${revision}
+
+
+
+
+
+
+ org.codehaus.mojo
+ versions-maven-plugin
+
+ test-group:artifactB
+ 2.0.0
+ false
+ true
+
+ true
+
+
+
+
+
+
diff --git a/versions-maven-plugin/src/test/resources/org/codehaus/mojo/use-dep-version/properties/conflict-redefinition/child/pom.xml b/versions-maven-plugin/src/test/resources/org/codehaus/mojo/use-dep-version/properties/conflict-redefinition/child/pom.xml
new file mode 100644
index 0000000000..417a2aec32
--- /dev/null
+++ b/versions-maven-plugin/src/test/resources/org/codehaus/mojo/use-dep-version/properties/conflict-redefinition/child/pom.xml
@@ -0,0 +1,26 @@
+
+
+ 4.0.0
+
+
+ test-group
+ parent
+ 1.0.0
+
+
+ child
+ 1.0.0
+
+
+ 1.0.1
+
+
+
+
+ test-group
+ artifactA
+ ${revision}
+
+
+
+
diff --git a/versions-maven-plugin/src/test/resources/org/codehaus/mojo/use-dep-version/properties/conflict-redefinition/pom.xml b/versions-maven-plugin/src/test/resources/org/codehaus/mojo/use-dep-version/properties/conflict-redefinition/pom.xml
new file mode 100644
index 0000000000..bdfc03ac6a
--- /dev/null
+++ b/versions-maven-plugin/src/test/resources/org/codehaus/mojo/use-dep-version/properties/conflict-redefinition/pom.xml
@@ -0,0 +1,43 @@
+
+
+ 4.0.0
+
+ test-group
+ parent
+ 1.0.0
+ pom
+
+
+ 1.0.0-SNAPSHOT
+
+
+
+ child
+
+
+
+
+ test-group
+ artifactB
+ ${revision}
+
+
+
+
+
+
+ org.codehaus.mojo
+ versions-maven-plugin
+
+ test-group:artifactA
+ 2.0.0
+ false
+ true
+
+ true
+
+
+
+
+
+
diff --git a/versions-maven-plugin/src/test/resources/org/codehaus/mojo/use-dep-version/properties/conflict/pom.xml b/versions-maven-plugin/src/test/resources/org/codehaus/mojo/use-dep-version/properties/conflict/pom.xml
new file mode 100644
index 0000000000..7ebdd91f88
--- /dev/null
+++ b/versions-maven-plugin/src/test/resources/org/codehaus/mojo/use-dep-version/properties/conflict/pom.xml
@@ -0,0 +1,43 @@
+
+
+ 4.0.0
+
+ test-group
+ test-artifact
+ DEVELOP-SNAPSHOT
+
+
+ 1.0.0-SNAPSHOT
+
+
+
+
+ test-group
+ artifactA
+ ${revision}
+
+
+ test-group
+ artifactB
+ ${revision}
+
+
+
+
+
+
+ org.codehaus.mojo
+ versions-maven-plugin
+
+ serverId
+ test-group:artifactA
+ 2.0.0
+ true
+
+
+
+
+
+
diff --git a/versions-maven-plugin/src/test/resources/org/codehaus/mojo/use-dep-version/properties/simple-profiles/pom.xml b/versions-maven-plugin/src/test/resources/org/codehaus/mojo/use-dep-version/properties/simple-profiles/pom.xml
new file mode 100644
index 0000000000..0e1bd4e6e5
--- /dev/null
+++ b/versions-maven-plugin/src/test/resources/org/codehaus/mojo/use-dep-version/properties/simple-profiles/pom.xml
@@ -0,0 +1,47 @@
+
+
+ 4.0.0
+
+ test-group
+ test-artifact
+ DEVELOP-SNAPSHOT
+
+
+
+ test-profile
+
+ true
+
+
+ 1.0.0-SNAPSHOT
+
+
+
+
+ default-group
+ artifactA
+ ${revision}
+
+
+
+
+
+
+
+
+
+ org.codehaus.mojo
+ versions-maven-plugin
+
+ serverId
+ default-group
+ 2.0.0
+ true
+
+
+
+
+
+
diff --git a/versions-maven-plugin/src/test/resources/org/codehaus/mojo/use-dep-version/properties/simple/pom.xml b/versions-maven-plugin/src/test/resources/org/codehaus/mojo/use-dep-version/properties/simple/pom.xml
new file mode 100644
index 0000000000..ebc4594e48
--- /dev/null
+++ b/versions-maven-plugin/src/test/resources/org/codehaus/mojo/use-dep-version/properties/simple/pom.xml
@@ -0,0 +1,38 @@
+
+
+ 4.0.0
+
+ test-group
+ test-artifact
+ DEVELOP-SNAPSHOT
+
+
+ 1.0.0-SNAPSHOT
+
+
+
+
+ default-group
+ artifactA
+ ${revision}
+
+
+
+
+
+
+ org.codehaus.mojo
+ versions-maven-plugin
+
+ serverId
+ default-group
+ 2.0.0
+ true
+
+
+
+
+
+