Package org.sonatype.aether.repository

Examples of org.sonatype.aether.repository.RemoteRepository


    }


    public static RemoteRepository newCentralRepository()
    {
        return new RemoteRepository( "central", "default", "http://repo1.maven.org/maven2/" );
    }
View Full Code Here


        return new RemoteRepository( "central", "default", "http://repo1.maven.org/maven2/" );
    }

    public static RemoteRepository newSonatypeRepository()
    {
        return new RemoteRepository( "sonatype-snapshots", "default", "https://oss.sonatype.org/content/repositories/snapshots/" );
    }
View Full Code Here

                url = matcher.group(3).trim();
            } else {
                url = repo;
            }

            RemoteRepository remote = new RemoteRepository(id, layout, url);

            if(url.contains("snapshot")){
                remote.setPolicy(true, new RepositoryPolicy(true, RepositoryPolicy.UPDATE_POLICY_ALWAYS,
                    RepositoryPolicy.CHECKSUM_POLICY_WARN));
            }

            return remote;
        }
View Full Code Here

         {
            ArtifactRequest request = new ArtifactRequest();
            ArtifactRepository ar = versions.getRepository(version);
            if (ar instanceof RemoteRepository)
            {
               RemoteRepository remoteRepo = new RemoteRepository(ar.getId(), ar.getContentType(),
                           ((RemoteRepository) ar).getUrl());
               request.addRepository(remoteRepo);
               DependencyBuilder currentVersion = DependencyBuilder.create(dep).setVersion(version.toString());
               request.setArtifact(dependencyToMavenArtifact(currentVersion));
View Full Code Here

      return session;
   }

   private RemoteRepository convertToMavenRepo(final DependencyRepository repo)
   {
      return new RemoteRepository(repo.getId(), "default", repo.getUrl());
   }
View Full Code Here

            hasCentral = true;
         }
      }
      if (!hasCentral)
      {
         RemoteRepository central = convertToMavenRepo(new DependencyRepositoryImpl(KnownRepository.CENTRAL.getId(),
                  KnownRepository.CENTRAL.getUrl()));
         central.setPolicy(true, new RepositoryPolicy().setEnabled(false));
         remoteRepos.add(central);
      }
      return remoteRepos;
   }
View Full Code Here

    }

    @Test
    public void testCreateSimpleRepo() {
        String plainUrl = "http://some.repo.url/somepath";
        RemoteRepository repository = createRemoteRepository(plainUrl);
        assertNotNull(repository);
        assertNotNull(repository.getId());
        assertNull(repository.getAuthentication());
    }
View Full Code Here

    }

    @Test
    public void testCreateRepWithCredentials() {
        String plainUrl = "http://user:password@some.repo.url/somepath";
        RemoteRepository repository = createRemoteRepository(plainUrl);
        assertNotNull(repository);
        assertNotNull(repository.getId());
        assertNotNull(repository.getAuthentication());
        assertEquals("user", repository.getAuthentication().getUsername());
        assertEquals("password", repository.getAuthentication().getPassword());
        assertEquals("http://some.repo.url/somepath", repository.getUrl());
    }
View Full Code Here

        this.repoType = repoType;
        this.authentication = authentication;
    }

    public RemoteRepository toRemoteRepository() {
        RemoteRepository remoteRepository = new RemoteRepository(this.id, this.repoType, this.url);
        if (this.authentication != null) {
            remoteRepository.setAuthentication(this.authentication);
        }
        return remoteRepository;
    }
View Full Code Here

       
        List<RemoteRepository> repositories = resolver.getRemoteRepositories();       
        assertEquals(2, repositories.size());
       
        // first repository is http://user:password@somehost/path/to/repo
        RemoteRepository repo = repositories.get(0);
        assertEquals("host1", repo.getHost());
        assertEquals("user", repo.getAuthentication().getUsername());
        assertEquals("password", repo.getAuthentication().getPassword());

        // second repository is http://host2/path/to/repo@snapshots
        repo = repositories.get(1);
        assertEquals("host2", repo.getHost());
        assertNull(repo.getAuthentication());
        assertTrue("@snapshots enables snapshots", repo.getPolicy(true).isEnabled());
    }
View Full Code Here

TOP

Related Classes of org.sonatype.aether.repository.RemoteRepository

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.