-
Notifications
You must be signed in to change notification settings - Fork 269
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#190 Fixing issue in update-child-modules, where root module's version was being used in all downstream children even when a child's parent was different. Fix was to stop updating local reactor model, as the module's version was being replaced with a parent version in error, initial reactor model doesn't require being updated locally. Testing: All initial and additional IT's passed running mvn clean verify. Change-Id: I8682a450fe6c15af8483a80a40f52e2e57377c3e
- Loading branch information
Showing
8 changed files
with
277 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>localhost</groupId> | ||
<artifactId>it-302</artifactId> | ||
<version>1.0</version> | ||
</parent> | ||
|
||
<groupId>localhost</groupId> | ||
<artifactId>it-302-child</artifactId> | ||
<version>4.0</version> | ||
<packaging>pom</packaging> | ||
|
||
<modules> | ||
<module>subchild</module> | ||
<module>subchild2</module> | ||
</modules> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>localhost</groupId> | ||
<artifactId>it-302-child</artifactId> | ||
<version>1.0</version> | ||
</parent> | ||
|
||
<groupId>localhost</groupId> | ||
<artifactId>it-302-subchild</artifactId> | ||
<version>2.0</version> | ||
<packaging>pom</packaging> | ||
|
||
</project> |
16 changes: 16 additions & 0 deletions
16
src/it/it-update-child-modules-002/child/subchild2/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>localhost</groupId> | ||
<artifactId>it-302-child</artifactId> | ||
<version>1.0</version> | ||
</parent> | ||
|
||
<groupId>localhost</groupId> | ||
<artifactId>it-302-subchild2</artifactId> | ||
<version>2.0</version> | ||
<packaging>pom</packaging> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>localhost</groupId> | ||
<artifactId>it-302</artifactId> | ||
<version>1.0</version> | ||
</parent> | ||
|
||
<groupId>localhost</groupId> | ||
<artifactId>it-302-child2</artifactId> | ||
<version>4.0</version> | ||
<packaging>pom</packaging> | ||
|
||
|
||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>localhost</groupId> | ||
<artifactId>it-302</artifactId> | ||
<version>5.0</version> | ||
<packaging>pom</packaging> | ||
<name>update-child-modules</name> | ||
|
||
<modules> | ||
<module>child</module> | ||
<module>child2</module> | ||
</modules> | ||
|
||
<build> | ||
<pluginManagement> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-antrun-plugin</artifactId> | ||
<version>1.1</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-assembly-plugin</artifactId> | ||
<version>2.2-beta-2</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-clean-plugin</artifactId> | ||
<version>2.2</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>2.0.2</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-dependency-plugin</artifactId> | ||
<version>2.0</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-deploy-plugin</artifactId> | ||
<version>2.3</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-ear-plugin</artifactId> | ||
<version>2.3.1</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-ejb-plugin</artifactId> | ||
<version>2.1</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-install-plugin</artifactId> | ||
<version>2.2</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<version>2.2</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-javadoc-plugin</artifactId> | ||
<version>2.4</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-plugin-plugin</artifactId> | ||
<version>2.4.1</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-rar-plugin</artifactId> | ||
<version>2.2</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-release-plugin</artifactId> | ||
<version>2.0-beta-7</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-resources-plugin</artifactId> | ||
<version>2.2</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-site-plugin</artifactId> | ||
<version>2.0</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-source-plugin</artifactId> | ||
<version>2.0.4</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>2.4.2</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-war-plugin</artifactId> | ||
<version>2.1-alpha-1</version> | ||
</plugin> | ||
</plugins> | ||
</pluginManagement> | ||
</build> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<parent>\\E.*\\Q<version>\\E\\s*5\\.0\\s*\\Q</version>\\E.*\\Q</parent>\\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<parent>\\E.*\\Q<version>\\E\\s*4\\.0\\s*\\Q</version>\\E.*\\Q</parent>\\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<parent>\\E.*\\Q<version>\\E\\s*4\\.0\\s*\\Q</version>\\E.*\\Q</parent>\\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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters