diff --git a/versions-maven-plugin/src/it/it-update-properties-issue-837/invoker.properties b/versions-maven-plugin/src/it/it-update-properties-issue-837/invoker.properties
new file mode 100644
index 0000000000..b992cb3c77
--- /dev/null
+++ b/versions-maven-plugin/src/it/it-update-properties-issue-837/invoker.properties
@@ -0,0 +1,2 @@
+invoker.goals = ${project.groupId}:${project.artifactId}:${project.version}:update-properties
+invoker.mavenOpts = -DincludeParent=false
diff --git a/versions-maven-plugin/src/it/it-update-properties-issue-837/parent-pom.xml b/versions-maven-plugin/src/it/it-update-properties-issue-837/parent-pom.xml
new file mode 100644
index 0000000000..d01abb3eec
--- /dev/null
+++ b/versions-maven-plugin/src/it/it-update-properties-issue-837/parent-pom.xml
@@ -0,0 +1,14 @@
+
+ 4.0.0
+
+ default-group
+ parent-artifact
+ 1.0.0
+ pom
+
+
+ 1.0
+
+
+
diff --git a/versions-maven-plugin/src/it/it-update-properties-issue-837/pom.xml b/versions-maven-plugin/src/it/it-update-properties-issue-837/pom.xml
new file mode 100644
index 0000000000..e80ba17a43
--- /dev/null
+++ b/versions-maven-plugin/src/it/it-update-properties-issue-837/pom.xml
@@ -0,0 +1,23 @@
+
+ 4.0.0
+
+
+ default-group
+ parent-artifact
+ 1.0.0
+ parent-pom.xml
+
+
+ child-artifact
+ 1.0.0
+
+
+
+ localhost
+ dummy-api
+ ${artifact-version}
+
+
+
+
diff --git a/versions-maven-plugin/src/it/it-update-properties-issue-837/verify.groovy b/versions-maven-plugin/src/it/it-update-properties-issue-837/verify.groovy
new file mode 100644
index 0000000000..5b4f858adb
--- /dev/null
+++ b/versions-maven-plugin/src/it/it-update-properties-issue-837/verify.groovy
@@ -0,0 +1 @@
+assert ! ( new File( basedir, "build.log" ).text.contains( 'Property ${artifact-version}' ) )
diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UpdatePropertiesMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UpdatePropertiesMojo.java
index 8292a6926d..a0394a08c7 100644
--- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UpdatePropertiesMojo.java
+++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UpdatePropertiesMojo.java
@@ -44,6 +44,7 @@
import org.codehaus.mojo.versions.recording.DefaultChangeRecord;
import org.codehaus.mojo.versions.rewriting.ModifiedPomXMLEventReader;
+import static java.util.Optional.ofNullable;
import static org.codehaus.mojo.versions.utils.SegmentUtils.determineUnchangedSegment;
/**
@@ -133,6 +134,16 @@ public class UpdatePropertiesMojo extends AbstractVersionsDependencyUpdaterMojo
defaultValue = "true" )
protected boolean allowIncrementalUpdates = true;
+ /**
+ *
Whether to include parent POMs in the search. Default: {@code true}
+ * Setting this to {@code false} can speed up execution, but will not resolve
+ * property-bound dependencies, defined in parent POMs.
+ *
+ * @since 2.14.0
+ */
+ @Parameter( property = "includeParent", defaultValue = "true" )
+ protected boolean includeParent = true;
+
// -------------------------- STATIC METHODS --------------------------
// -------------------------- OTHER METHODS --------------------------
@@ -164,6 +175,7 @@ protected void update( ModifiedPomXMLEventReader pom )
.withIncludeProperties( includeProperties )
.withExcludeProperties( excludeProperties )
.withAutoLinkItems( autoLinkItems )
+ .withIncludeParent( includeParent )
.build() );
for ( Map.Entry entry : propertyVersions.entrySet() )
{
@@ -200,7 +212,7 @@ protected void update( ModifiedPomXMLEventReader pom )
updatePropertyToNewestVersion( pom, property, version, currentVersion,
allowDowngrade, unchangedSegment );
- if ( targetVersion != null )
+ if ( pom.isModified() )
{
for ( final ArtifactAssociation association : version.getAssociations() )
{
@@ -211,7 +223,9 @@ protected void update( ModifiedPomXMLEventReader pom )
ChangeRecord.ChangeKind.PROPERTY )
.withArtifact( association.getArtifact() )
.withOldVersion( currentVersion )
- .withNewVersion( targetVersion.toString() )
+ .withNewVersion( ofNullable( targetVersion )
+ .map( ArtifactVersion::toString )
+ .orElse( "(empty)" ) )
.build() );
}
}