Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,74 @@ public void testitPackagePhase() throws Exception {
verifier.execute();
verifier.verifyErrorFreeLog();

String prefix = matchesVersionRange("[4.0.0-alpha-4,)") ? "dependency-0.1-SNAPSHOT-" : "";
String prefix = "";

List<String> classpath;

classpath = verifier.loadLines("consumer-a/target/compile.txt", "UTF-8");
assertContains(classpath, new String[] {prefix + "tests.jar"});
assertNotContains(classpath, new String[] {prefix + "client.jar"});
classpath = verifier.loadLines("consumer-a/target/runtime.txt", "UTF-8");
assertContains(classpath, new String[] {prefix + "tests.jar"});
assertNotContains(classpath, new String[] {prefix + "client.jar"});
classpath = verifier.loadLines("consumer-a/target/test.txt", "UTF-8");
assertContains(classpath, new String[] {prefix + "tests.jar"});
assertNotContains(classpath, new String[] {prefix + "client.jar"});

classpath = verifier.loadLines("consumer-b/target/compile.txt", "UTF-8");
assertContains(classpath, new String[] {prefix + "client.jar"});
assertNotContains(classpath, new String[] {prefix + "tests.jar"});
classpath = verifier.loadLines("consumer-b/target/runtime.txt", "UTF-8");
assertContains(classpath, new String[] {prefix + "client.jar"});
assertNotContains(classpath, new String[] {prefix + "tests.jar"});
classpath = verifier.loadLines("consumer-b/target/test.txt", "UTF-8");
assertContains(classpath, new String[] {prefix + "client.jar"});
assertNotContains(classpath, new String[] {prefix + "tests.jar"});

classpath = verifier.loadLines("consumer-c/target/compile.txt", "UTF-8");
assertContains(classpath, new String[] {prefix + "client.jar"});
assertContains(classpath, new String[] {prefix + "tests.jar"});
classpath = verifier.loadLines("consumer-c/target/runtime.txt", "UTF-8");
assertContains(classpath, new String[] {prefix + "client.jar"});
assertContains(classpath, new String[] {prefix + "tests.jar"});
classpath = verifier.loadLines("consumer-c/target/test.txt", "UTF-8");
assertContains(classpath, new String[] {prefix + "client.jar"});
assertContains(classpath, new String[] {prefix + "tests.jar"});
}

/**
* Test that dependency resolution still uses the actual artifact files once these have been
* assembled/attached in the "package" phase. This ensures the class path is accurate and not locked to
* the output directories of the best effort model from above.
*
* @throws Exception in case of failure
*/
@Test
public void testitPackagePhasesSlitted() throws Exception {
requiresMavenVersion("[4.0.0-beta-4,)");

File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3043");

Verifier verifier = newVerifier(testDir.getAbsolutePath());
verifier.setAutoclean(false);
verifier.deleteDirectory("target");
verifier.deleteDirectory("consumer-a/target");
verifier.deleteDirectory("consumer-b/target");
verifier.deleteDirectory("consumer-c/target");
verifier.deleteArtifacts("org.apache.maven.its.mng3043");
verifier.setLogFileName("log-package-pre.txt");
verifier.addCliArguments("--also-make", "--projects", ":dependency", "package");
verifier.execute();
verifier.verifyErrorFreeLog();

verifier = newVerifier(testDir.getAbsolutePath());
verifier.setAutoclean(false);
verifier.setLogFileName("log-package-pre.txt");
verifier.addCliArguments("--projects", ":consumer-a,:consumer-b,:consumer-c", "package");
verifier.execute();
verifier.verifyErrorFreeLog();

String prefix = "dependency-0.1-SNAPSHOT-";

List<String> classpath;

Expand Down
1 change: 1 addition & 0 deletions core-it-suite/src/test/resources-filtered/bootstrap.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ org.apache.geronimo.specs:geronimo-jcdi_2.0_spec:1.3
org.apache.groovy:groovy-ant:4.0.15
org.apache.groovy:groovy:4.0.15
org.apache.maven:maven-api-impl:4.0.0-beta-3
org.apache.maven:maven-api-di:4.0.0-beta-3
org.apache.maven:maven-api-spi:4.0.0-alpha-8
org.apache.maven:maven-api-model:mdo:4.0.0-alpha-8
org.apache.maven.extensions:maven-extensions:pom:41
Expand Down