Package org.eclipse.aether

Examples of org.eclipse.aether.DefaultRepositorySystemSession


        return locator.getService( RepositorySystem.class );
    }

    private RepositorySystemSession newRepositorySystemSession( RepositorySystem system ) {
        LocalRepository localRepo = new LocalRepository( localRepoDir );
        DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
        session.setLocalRepositoryManager( system.newLocalRepositoryManager( session, localRepo ) );
        session.setOffline(offline);
        return session;
    }
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(system.newLocalRepositoryManager(repositorySession, localRepo));
         repositorySession.setOffline(offline);
         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

      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

    }

    private DependencyNode getDependencyTree(Artifact artifact) throws MojoExecutionException {
        try {
            CollectRequest collectRequest = new CollectRequest(new Dependency(artifact, "compile"), null, projectRepositories);
            DefaultRepositorySystemSession session = new DefaultRepositorySystemSession(repositorySystemSession);
            session.setDependencySelector(new AndDependencySelector(new OptionalDependencySelector(),
                    new ScopeDependencySelector1(),
                    new ExclusionDependencySelector()));
            // between aether-util 0.9.0.M1 and M2, JavaEffectiveScopeCalculator was removed
            // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=397241
            DependencyGraphTransformer transformer = new ChainedDependencyGraphTransformer(new ConflictMarker(),
                    new ConflictResolver(new NearestVersionSelector(), new JavaScopeSelector(), new SimpleOptionalitySelector(), new JavaScopeDeriver()),
                    new JavaDependencyContextRefiner());
            session.setDependencyGraphTransformer(transformer);
            CollectResult result = repositorySystem.collectDependencies(session, collectRequest);
            return result.getRoot();
        } catch (DependencyCollectionException e) {
            throw new MojoExecutionException("Cannot build project dependency tree", e);
        }
View Full Code Here

        // second try, refetch all (possibly outdated) metadata that wasn't updated in the first attempt

        if ( !request.getRepositorySession().isOffline() && !requests.isEmpty() )
        {
            DefaultRepositorySystemSession session =
                new DefaultRepositorySystemSession( request.getRepositorySession() );
            session.setUpdatePolicy( RepositoryPolicy.UPDATE_POLICY_ALWAYS );

            results = repositorySystem.resolveMetadata( session, requests );

            return processResults( request, trace, results, null );
        }
View Full Code Here

                return session;
            }
        }
        else
        {
            session = new DefaultRepositorySystemSession();
        }

        final LocalRepositoryManager llrm = new LegacyLocalRepositoryManager( repository );

        return new DefaultRepositorySystemSession( session ).setLocalRepositoryManager( llrm );
    }
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.