Package org.eclipse.aether

Examples of org.eclipse.aether.DefaultRepositorySystemSession


   public Model loadPomFromFile(File pomFile, String... profiles)
   {
      RepositorySystem system = mavenContainer.getRepositorySystem();
      Settings settings = mavenContainer.getSettings();
      DefaultRepositorySystemSession session = mavenContainer.setupRepoSession(system, settings);
      final DefaultModelBuildingRequest request = new DefaultModelBuildingRequest()
               .setSystemProperties(System.getProperties())
               .setPomFile(pomFile)
               .setActiveProfileIds(settings.getActiveProfiles());
      ModelBuilder builder = new DefaultModelBuilderFactory().newInstance();
View Full Code Here


               }
            }
            request.setRemoteRepositories(settingsRepos);
            request.setSystemProperties(System.getProperties());

            DefaultRepositorySystemSession repositorySession = MavenRepositorySystemUtils.newSession();
            Proxy activeProxy = settings.getActiveProxy();
            if (activeProxy != null)
            {
               DefaultProxySelector dps = new DefaultProxySelector();
               dps.add(RepositoryUtils.convertFromMavenProxy(activeProxy), activeProxy.getNonProxyHosts());
               repositorySession.setProxySelector(dps);
            }
            LocalRepository localRepo = new LocalRepository(settings.getLocalRepository());

            repositorySession.setLocalRepositoryManager(repositorySystem.newLocalRepositoryManager(repositorySession,
                     localRepo));
            repositorySession.setOffline(settings.isOffline());
            List<Mirror> mirrors = executionRequest.getMirrors();
            if (mirrors != null)
            {
               DefaultMirrorSelector mirrorSelector = new DefaultMirrorSelector();
               for (Mirror mirror : mirrors)
               {
                  mirrorSelector.add(mirror.getId(), mirror.getUrl(), mirror.getLayout(), false, mirror.getMirrorOf(),
                           mirror.getMirrorOfLayouts());
               }
               repositorySession.setMirrorSelector(mirrorSelector);
            }

            request.setRepositorySession(repositorySession);
            request.setProcessPlugins(false);
            request.setResolveDependencies(false);
View Full Code Here

    return locator.getService(RepositorySystem.class);
  }

  public static DefaultRepositorySystemSession newRepositorySystemSession(RepositorySystem system) {
    DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
   
    System.out.println("Using local repository: " + getLocalRepositoryDir());
   
    LocalRepository localRepo = new LocalRepository(getLocalRepositoryDir());
    session.setLocalRepositoryManager(system.newLocalRepositoryManager(session, localRepo));

    session.setTransferListener(new ConsoleTransferListener());
    session.setRepositoryListener(new ConsoleRepositoryListener());

    // uncomment to generate dirty trees
    // session.setDependencyGraphTransformer( null );

    return session;
View Full Code Here

   public Model loadPomFromFile(File pomFile, String... profiles)
   {
      RepositorySystem system = mavenContainer.getRepositorySystem();
      Settings settings = mavenContainer.getSettings();
      DefaultRepositorySystemSession session = mavenContainer.setupRepoSession(system, settings);
      final DefaultModelBuildingRequest request = new DefaultModelBuildingRequest()
               .setSystemProperties(System.getProperties())
               .setPomFile(pomFile)
               .setActiveProfileIds(settings.getActiveProfiles());
      ModelBuilder builder = new DefaultModelBuilderFactory().newInstance();
View Full Code Here

               }
            }
            request.setRemoteRepositories(settingsRepos);
            request.setSystemProperties(System.getProperties());

            DefaultRepositorySystemSession repositorySession = MavenRepositorySystemUtils.newSession();
            Proxy activeProxy = settings.getActiveProxy();
            if (activeProxy != null)
            {
               DefaultProxySelector dps = new DefaultProxySelector();
               dps.add(RepositoryUtils.convertFromMavenProxy(activeProxy), activeProxy.getNonProxyHosts());
               repositorySession.setProxySelector(dps);
            }
            LocalRepository localRepo = new LocalRepository(settings.getLocalRepository());

            repositorySession.setLocalRepositoryManager(repositorySystem.newLocalRepositoryManager(repositorySession,
                     localRepo));
            repositorySession.setOffline(settings.isOffline());
            List<Mirror> mirrors = executionRequest.getMirrors();
            DefaultMirrorSelector mirrorSelector = new DefaultMirrorSelector();
            if (mirrors != null)
            {
               for (Mirror mirror : mirrors)
               {
                  mirrorSelector.add(mirror.getId(), mirror.getUrl(), mirror.getLayout(), false, mirror.getMirrorOf(),
                           mirror.getMirrorOfLayouts());
               }
            }
            repositorySession.setMirrorSelector(mirrorSelector);
           
            LazyAuthenticationSelector authSelector = new LazyAuthenticationSelector(mirrorSelector);
            for (Server server : settings.getServers())
            {
               authSelector.add(
                        server.getId(),
                        new AuthenticationBuilder().addUsername(server.getUsername()).addPassword(server.getPassword())
                                 .addPrivateKey(server.getPrivateKey(), server.getPassphrase()).build());
            }
            repositorySession.setAuthenticationSelector(authSelector);

            request.setRepositorySession(repositorySession);
            request.setProcessPlugins(false);
            request.setResolveDependencies(false);
            this.request = request;
View Full Code Here

      Set<Dependency> result = new HashSet<Dependency>();
      Predicate<Dependency> filter = query.getDependencyFilter();
      RepositorySystem system = container.getRepositorySystem();
      Settings settings = container.getSettings();

      DefaultRepositorySystemSession session = container.setupRepoSession(system, settings);

      Artifact queryArtifact = MavenConvertUtils.coordinateToMavenArtifact(query.getCoordinate());

      List<RemoteRepository> remoteRepos = MavenRepositories.getRemoteRepositories(container, settings, query);
View Full Code Here

         }

         RepositorySystem maven = container.getRepositorySystem();
         Settings settings = container.getSettings();

         DefaultRepositorySystemSession session = container.setupRepoSession(maven, settings);
         Artifact artifact = MavenConvertUtils.coordinateToMavenArtifact(dep);

         List<RemoteRepository> remoteRepos = MavenRepositories.getRemoteRepositories(container, settings, query);

         VersionRangeRequest rangeRequest = new VersionRangeRequest(artifact, remoteRepos, null);
View Full Code Here

      RepositorySystem system = container.getRepositorySystem();
      Settings settings = container.getSettings();

      List<RemoteRepository> remoteRepos = MavenRepositories.getRemoteRepositories(container, settings, query);

      DefaultRepositorySystemSession session = container.setupRepoSession(system, settings);
      Artifact queryArtifact = MavenConvertUtils.coordinateToMavenArtifact(query.getCoordinate());
      ArtifactRequest request = new ArtifactRequest(queryArtifact, remoteRepos, null);
      try
      {
         ArtifactResult resolvedArtifact = system.resolveArtifact(session, request);
View Full Code Here

   {
      try
      {
         RepositorySystem system = container.getRepositorySystem();
         Settings settings = container.getSettings();
         DefaultRepositorySystemSession session = container.setupRepoSession(system, settings);
         session.setDependencyTraverser(new DependencyTraverser()
         {
            @Override
            public boolean traverseDependency(org.eclipse.aether.graph.Dependency dependency)
            {
               if (query.getScopeType() != null)
                  return query.getScopeType().equals(dependency.getScope());
               else
                  return !"test".equals(dependency.getScope());
            }

            @Override
            public DependencyTraverser deriveChildTraverser(DependencyCollectionContext context)
            {
               return this;
            }
         });
         session.setDependencySelector(new ScopeDependencySelector("test"));

         final CoordinateBuilder coord = CoordinateBuilder.create(query.getCoordinate());
         Artifact queryArtifact = MavenConvertUtils.coordinateToMavenArtifact(coord);

         List<RemoteRepository> remoteRepos = MavenRepositories.getRemoteRepositories(container, settings, query);
View Full Code Here

         }

         RepositorySystem system = container.getRepositorySystem();
         Settings settings = container.getSettings();

         DefaultRepositorySystemSession session = container.setupRepoSession(system, settings);
         Artifact artifact = MavenConvertUtils.coordinateToMavenArtifact(query.getCoordinate());

         List<RemoteRepository> mavenRepositories = MavenRepositories.getRemoteRepositories(container, settings, query);
         ArtifactDescriptorRequest ar = new ArtifactDescriptorRequest(artifact, mavenRepositories, null);
         ArtifactDescriptorResult results = system.readArtifactDescriptor(session, ar);
View Full Code Here

TOP

Related Classes of org.eclipse.aether.DefaultRepositorySystemSession

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.