1 package org.apache.maven.it;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.io.File;
23 import java.net.URI;
24 import org.apache.maven.it.util.ResourceExtractor;
25
26
27
28
29 public class MavenITmng6759TransitiveDependencyRepositoriesTest extends AbstractMavenIntegrationTestCase {
30
31 private final String projectBaseDir = "/mng-6759-transitive-dependency-repositories";
32
33 public MavenITmng6759TransitiveDependencyRepositoriesTest() {
34 super( "(,3.6.2),(3.6.2,)" );
35 }
36
37
38
39
40
41
42
43 public void testTransitiveDependenciesAccountForRepositoriesListedByDependencyTrailPredecessor() throws Exception {
44 installDependencyCInCustomRepo();
45 File testDir = ResourceExtractor.simpleExtractResources( getClass(), projectBaseDir );
46
47 Verifier verifier = newVerifier( testDir.getAbsolutePath() );
48
49 verifier.executeGoal( "package" );
50 verifier.verifyErrorFreeLog();
51 }
52
53 private void installDependencyCInCustomRepo() throws Exception {
54 File dependencyCProjectDir = ResourceExtractor.simpleExtractResources( getClass(), projectBaseDir + "/dependency-in-custom-repo" );
55 URI customRepoUri = new File(new File(dependencyCProjectDir, "target" ), "repo" ).toURI();
56 Verifier verifier = newVerifier( dependencyCProjectDir.getAbsolutePath() );
57
58 verifier.deleteDirectory( "target" );
59 if ( getMavenVersion().getMajorVersion() <= 3 )
60 {
61 verifier.addCliOption( "-DaltDeploymentRepository=customRepo::default::" + customRepoUri );
62 }
63 else
64 {
65 verifier.addCliOption( "-DaltDeploymentRepository=customRepo::" + customRepoUri );
66 }
67 verifier.executeGoal( "deploy" );
68 verifier.verifyErrorFreeLog();
69 }
70
71 }