Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/it/projects/get-classpath/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,18 @@ String mavenVersion = new File( basedir, "build.log" ).readLines().find { it.sta
assert mavenVersion != null : "No Maven version in build.log";
String leafVersion = mavenVersion.startsWith( "Apache Maven 4" ) ? "2.0" : "1.0";

// Maven 3.9 and earlier (Resolver 1.x) place a transitive dependency reached through another dependency
// before that dependency's own siblings; Maven 3.10+ and 4 (Resolver 2.x) place it after. The IT's project
// reaches the leaf only through the dep, so its position relative to runtime depends on the resolver line.
def version = ( mavenVersion =~ /Apache Maven (\d+)\.(\d+)/ );
assert version.find() : "Could not parse a Maven version from: " + mavenVersion;
boolean leafBeforeRuntime = ( version.group( 1 ) as int ) == 3 && ( version.group( 2 ) as int ) < 10;

String leaf = new File( localRepositoryPath,
"org/apache/maven/its/dependency/get-classpath-lib-leaf/" + leafVersion + "/get-classpath-lib-leaf-" + leafVersion + ".jar" ).getPath();
String expected = [ jar( "get-classpath-lib" ), jar( "get-classpath-lib-dep" ), jar( "get-classpath-lib-runtime" ), leaf ]
String runtime = jar( "get-classpath-lib-runtime" );
String expected = [ jar( "get-classpath-lib" ), jar( "get-classpath-lib-dep" ) ]
.plus( leafBeforeRuntime ? [ leaf, runtime ] : [ runtime, leaf ] )
.join( File.pathSeparator );
String actual = read( "classpath.txt" );
assert actual.equals( expected ) : "Unexpected classpath: " + actual + ", expected: " + expected + " for " + mavenVersion;
Expand Down
Loading