diff --git a/src/it/it-update-child-modules-002/child/pom.xml b/src/it/it-update-child-modules-002/child/pom.xml
new file mode 100644
index 0000000000..2a12a378a4
--- /dev/null
+++ b/src/it/it-update-child-modules-002/child/pom.xml
@@ -0,0 +1,21 @@
+
+ 4.0.0
+
+
+ localhost
+ it-302
+ 1.0
+
+
+ localhost
+ it-302-child
+ 4.0
+ pom
+
+
+ subchild
+ subchild2
+
+
+
diff --git a/src/it/it-update-child-modules-002/child/subchild/pom.xml b/src/it/it-update-child-modules-002/child/subchild/pom.xml
new file mode 100644
index 0000000000..3d67d6a4a5
--- /dev/null
+++ b/src/it/it-update-child-modules-002/child/subchild/pom.xml
@@ -0,0 +1,16 @@
+
+ 4.0.0
+
+
+ localhost
+ it-302-child
+ 1.0
+
+
+ localhost
+ it-302-subchild
+ 2.0
+ pom
+
+
diff --git a/src/it/it-update-child-modules-002/child/subchild2/pom.xml b/src/it/it-update-child-modules-002/child/subchild2/pom.xml
new file mode 100644
index 0000000000..d6ec3bc668
--- /dev/null
+++ b/src/it/it-update-child-modules-002/child/subchild2/pom.xml
@@ -0,0 +1,16 @@
+
+ 4.0.0
+
+
+ localhost
+ it-302-child
+ 1.0
+
+
+ localhost
+ it-302-subchild2
+ 2.0
+ pom
+
+
diff --git a/src/it/it-update-child-modules-002/child2/pom.xml b/src/it/it-update-child-modules-002/child2/pom.xml
new file mode 100644
index 0000000000..0b4b8bd604
--- /dev/null
+++ b/src/it/it-update-child-modules-002/child2/pom.xml
@@ -0,0 +1,18 @@
+
+ 4.0.0
+
+
+ localhost
+ it-302
+ 1.0
+
+
+ localhost
+ it-302-child2
+ 4.0
+ pom
+
+
+
+
diff --git a/src/it/it-update-child-modules-002/invoker.properties b/src/it/it-update-child-modules-002/invoker.properties
new file mode 100644
index 0000000000..af67275aa9
--- /dev/null
+++ b/src/it/it-update-child-modules-002/invoker.properties
@@ -0,0 +1,19 @@
+# first check that the root project builds ok
+invoker.goals.1=-o validate
+invoker.nonRecursive.1=true
+invoker.buildResult.1=success
+
+# second check that adding the child project into the mix breaks things
+invoker.goals.2=-o validate
+invoker.nonRecursive.2=false
+invoker.buildResult.2=failure
+
+# third fix the build with our plugin
+invoker.goals.3=${project.groupId}:${project.artifactId}:${project.version}:update-child-modules
+invoker.nonRecursive.3=true
+invoker.buildResult.3=success
+
+# forth, confirm that the build is fixed
+invoker.goals.4=validate
+invoker.nonRecursive.4=false
+invoker.buildResult.4=success
diff --git a/src/it/it-update-child-modules-002/pom.xml b/src/it/it-update-child-modules-002/pom.xml
new file mode 100644
index 0000000000..941377008d
--- /dev/null
+++ b/src/it/it-update-child-modules-002/pom.xml
@@ -0,0 +1,99 @@
+
+ 4.0.0
+
+ localhost
+ it-302
+ 5.0
+ pom
+ update-child-modules
+
+
+ child
+ child2
+
+
+
+
+
+
+ maven-antrun-plugin
+ 1.1
+
+
+ maven-assembly-plugin
+ 2.2-beta-2
+
+
+ maven-clean-plugin
+ 2.2
+
+
+ maven-compiler-plugin
+ 2.0.2
+
+
+ maven-dependency-plugin
+ 2.0
+
+
+ maven-deploy-plugin
+ 2.3
+
+
+ maven-ear-plugin
+ 2.3.1
+
+
+ maven-ejb-plugin
+ 2.1
+
+
+ maven-install-plugin
+ 2.2
+
+
+ maven-jar-plugin
+ 2.2
+
+
+ maven-javadoc-plugin
+ 2.4
+
+
+ maven-plugin-plugin
+ 2.4.1
+
+
+ maven-rar-plugin
+ 2.2
+
+
+ maven-release-plugin
+ 2.0-beta-7
+
+
+ maven-resources-plugin
+ 2.2
+
+
+ maven-site-plugin
+ 2.0
+
+
+ maven-source-plugin
+ 2.0.4
+
+
+ maven-surefire-plugin
+ 2.4.2
+
+
+ maven-war-plugin
+ 2.1-alpha-1
+
+
+
+
+
+
diff --git a/src/it/it-update-child-modules-002/verify.bsh b/src/it/it-update-child-modules-002/verify.bsh
new file mode 100644
index 0000000000..c8ebaac9c6
--- /dev/null
+++ b/src/it/it-update-child-modules-002/verify.bsh
@@ -0,0 +1,87 @@
+import java.io.*;
+import java.util.regex.*;
+
+try
+{
+ File file = new File( basedir, "child/pom.xml" );
+
+ BufferedReader in = new BufferedReader( new InputStreamReader( new FileInputStream( file ), "UTF-8" ) );
+ StringBuilder buf = new StringBuilder();
+ String line = in.readLine();
+ while ( line != null )
+ {
+ buf.append( line );
+ buf.append( " " );
+ line = in.readLine();
+ }
+
+ Pattern p = Pattern.compile( "\\Q\\E.*\\Q\\E\\s*5\\.0\\s*\\Q\\E.*\\Q\\E" );
+ Matcher m = p.matcher( buf.toString() );
+ if ( !m.find() )
+ {
+ System.out.println( "Updated parent of child module" );
+ return false;
+ }
+}
+catch( Throwable t )
+{
+ t.printStackTrace();
+ return false;
+}
+
+try
+{
+ File file = new File( basedir, "child/subchild/pom.xml" );
+
+ BufferedReader in = new BufferedReader( new InputStreamReader( new FileInputStream( file ), "UTF-8" ) );
+ StringBuilder buf = new StringBuilder();
+ String line = in.readLine();
+ while ( line != null )
+ {
+ buf.append( line );
+ buf.append( " " );
+ line = in.readLine();
+ }
+
+ Pattern p = Pattern.compile( "\\Q\\E.*\\Q\\E\\s*4\\.0\\s*\\Q\\E.*\\Q\\E" );
+ Matcher m = p.matcher( buf.toString() );
+ if ( !m.find() )
+ {
+ System.out.println( "Updated parent of subchild module" );
+ return false;
+ }
+}
+catch( Throwable t )
+{
+ t.printStackTrace();
+ return false;
+}
+try
+{
+ File file = new File( basedir, "child/subchild2/pom.xml" );
+
+ BufferedReader in = new BufferedReader( new InputStreamReader( new FileInputStream( file ), "UTF-8" ) );
+ StringBuilder buf = new StringBuilder();
+ String line = in.readLine();
+ while ( line != null )
+ {
+ buf.append( line );
+ buf.append( " " );
+ line = in.readLine();
+ }
+
+ Pattern p = Pattern.compile( "\\Q\\E.*\\Q\\E\\s*4\\.0\\s*\\Q\\E.*\\Q\\E" );
+ Matcher m = p.matcher( buf.toString() );
+ if ( !m.find() )
+ {
+ System.out.println( "Updated parent of subchild2 module" );
+ return false;
+ }
+}
+catch( Throwable t )
+{
+ t.printStackTrace();
+ return false;
+}
+
+return true;
diff --git a/src/main/java/org/codehaus/mojo/versions/UpdateChildModulesMojo.java b/src/main/java/org/codehaus/mojo/versions/UpdateChildModulesMojo.java
index 15799abe5c..9ffa142a7d 100644
--- a/src/main/java/org/codehaus/mojo/versions/UpdateChildModulesMojo.java
+++ b/src/main/java/org/codehaus/mojo/versions/UpdateChildModulesMojo.java
@@ -48,7 +48,6 @@
public class UpdateChildModulesMojo
extends AbstractVersionsUpdaterMojo
{
-
/**
* The groupId that we are updating. Guarded by this.
*/
@@ -129,7 +128,7 @@ else if ( d1 > d2 )
}
getLog().debug( "Looking for modules which use "
- + ArtifactUtils.versionlessKey( sourceGroupId, sourceArtifactId ) + " as their parent" );
+ + ArtifactUtils.versionlessKey( sourceGroupId, sourceArtifactId ) + " as their parent to update it to " + sourceVersion );
for ( Map.Entry target : PomHelper.getChildModels( reactor, sourceGroupId,
sourceArtifactId ).entrySet() )
@@ -169,8 +168,6 @@ else if ( d1 > d2 )
+ ArtifactUtils.versionlessKey( sourceGroupId, sourceArtifactId ) + ":"
+ sourceVersion );
process( moduleProjectFile );
- // don't forget to update the cached model
- targetModel.setVersion( sourceVersion );
didSomething = true;
}
}