当前位置: 首页>>代码示例>>Java>>正文


Java RepositorySystemSession类代码示例

本文整理汇总了Java中org.eclipse.aether.RepositorySystemSession的典型用法代码示例。如果您正苦于以下问题:Java RepositorySystemSession类的具体用法?Java RepositorySystemSession怎么用?Java RepositorySystemSession使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RepositorySystemSession类属于org.eclipse.aether包,在下文中一共展示了RepositorySystemSession类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: collectDependencies

import org.eclipse.aether.RepositorySystemSession; //导入依赖的package包/类
@Override
public CollectResult collectDependencies(RepositorySystemSession session, CollectRequest request) throws DependencyCollectionException {
    DefaultRepositorySystemSession cloned = new DefaultRepositorySystemSession(session);
    DependencyGraphTransformer transformer = session.getDependencyGraphTransformer();
    //need to reset the transformer to prevent the transformation to happen and to it below separately.
    cloned.setDependencyGraphTransformer(null);
    CollectResult res = super.collectDependencies(cloned, request);
    CloningDependencyVisitor vis = new CloningDependencyVisitor();
    res.getRoot().accept(vis);

    //this part copied from DefaultDependencyCollector
    try {
        DefaultDependencyGraphTransformationContext context =
                new DefaultDependencyGraphTransformationContext(session);
        res.setRoot(transformer.transformGraph(res.getRoot(), context));
    } catch (RepositoryException e) {
        res.addException(e);
    }

    if (!res.getExceptions().isEmpty()) {
        throw new DependencyCollectionException(res);
    }
    res.getRoot().setData("NB_TEST", vis.getRootNode());
    return res;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:NbRepositorySystem.java

示例2: put

import org.eclipse.aether.RepositorySystemSession; //导入依赖的package包/类
@Override
public void put(RepositorySystemSession session, Object key, Object data) {
    //we just let the pools to get overriden to new value, the worst that can happen is that
    //2 pools will coexist
    if (ARTIFACT_POOL.equals(key)) {
        synchronized (LOCK) {
            artifacts = data;
        }
        return;
    }
    if (DEPENDENCY_POOL.equals(key)) {
        synchronized (LOCK) {
            dependencies = data;
        }
        return;
    }
    superDelegate.put(session, key, data);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:NbRepositoryCache.java

示例3: resolve

import org.eclipse.aether.RepositorySystemSession; //导入依赖的package包/类
@Override
public Artifact resolve(Plugin plugin, List<RemoteRepository> repositories, RepositorySystemSession session) throws PluginResolutionException {
    WorkspaceReader wr = session.getWorkspaceReader();
    NbWorkspaceReader nbwr = null;
    if (wr instanceof NbWorkspaceReader) {
        nbwr = (NbWorkspaceReader)wr;
        //this only works reliably because the NbWorkspaceReader is part of the session, not a component
        nbwr.silence();
    }
    try {
        return super.resolve(plugin, repositories, session);
    } finally {
        if (nbwr != null) {
            nbwr.normal();
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:NbPluginDependenciesResolver.java

示例4: getLatestVersion

import org.eclipse.aether.RepositorySystemSession; //导入依赖的package包/类
private String getLatestVersion(String groupId, String artifactId, String range,
        RepositorySystemSession session, List<RemoteRepository> remotes)
        throws VersionRangeResolutionException {
    VersionRangeRequest rangeRequest = new VersionRangeRequest();
    rangeRequest.setArtifact(
            new DefaultArtifact(String.format("%s:%s:%s", groupId, artifactId, range)));
    rangeRequest.setRepositories(remotes);

    VersionRangeResult rangeResult = repoSystem.resolveVersionRange(session, rangeRequest);
    if (rangeResult.getHighestVersion() != null) {
        return rangeResult.getHighestVersion().toString();
    }
    else {
        throw new com.atomist.rug.resolver.maven.DependencyCollectionException(String
                .format("Unable to find a version of archive %s:%s.", groupId, artifactId),
                properties.repositories());
    }
}
 
开发者ID:atomist-attic,项目名称:rug-resolver,代码行数:19,代码来源:MavenBasedDependencyResolver.java

示例5: resolvePluginDependency

import org.eclipse.aether.RepositorySystemSession; //导入依赖的package包/类
/**
 * Uses the aether to resolve a plugin dependency and returns the file for further processing.
 *
 * @param d the dependency to resolve.
 * @param pluginRepos the plugin repositories to use for dependency resolution.
 * @param resolver the resolver for aether access.
 * @param repoSystemSession the session for the resolver.
 * @return optionally a file which is the resolved dependency.
 */
public static Optional<File> resolvePluginDependency(Dependency d, List<RemoteRepository> pluginRepos,
    ArtifactResolver resolver, RepositorySystemSession repoSystemSession) {
  Artifact a = new DefaultArtifact(d.getGroupId(), d.getArtifactId(), d.getClassifier(), d.getType(), d.getVersion());
  ArtifactRequest artifactRequest = new ArtifactRequest();
  artifactRequest.setArtifact(a);
  artifactRequest.setRepositories(pluginRepos);
  try {
    ArtifactResult artifactResult = resolver.resolveArtifact(repoSystemSession, artifactRequest);
    if (artifactResult.getArtifact() != null) {
      return Optional.fromNullable(artifactResult.getArtifact().getFile());
    }
    return Optional.absent();
  } catch (ArtifactResolutionException e) {
    return Optional.absent();
  }
}
 
开发者ID:shillner,项目名称:maven-cdi-plugin-utils,代码行数:26,代码来源:MavenUtil.java

示例6: main

import org.eclipse.aether.RepositorySystemSession; //导入依赖的package包/类
/**
 * Entry point for the JVM forked by {@link #testSeparateJVMs()}.
 */
public static void main(String[] arguments) throws IOException, AlreadyBoundException, NotBoundException {
    LocalController localController = new LocalController();

    Registry registry = LocateRegistry.createRegistry(REGISTRY_PORT);
    Controller controller = (Controller) UnicastRemoteObject.exportObject(localController, 0);
    registry.bind(CONTROLLER, controller);

    Path lockFile = Paths.get(arguments[0]);
    RepositorySystemSession repositorySystemSession = Mockito.mock(RepositorySystemSession.class);
    try (FileLockSyncContextFactory syncContextFactory = new FileLockSyncContextFactory(lockFile)) {
        new SyncTask(syncContextFactory, localController, repositorySystemSession).run();
    }

    UnicastRemoteObject.unexportObject(localController, true);
    UnicastRemoteObject.unexportObject(registry, true);
}
 
开发者ID:cloudkeeper-project,项目名称:cloudkeeper,代码行数:20,代码来源:ITFileLockSyncContextFactory.java

示例7: setupArtifact

import org.eclipse.aether.RepositorySystemSession; //导入依赖的package包/类
@SuppressWarnings( "unchecked" )
void setupArtifact( String groupId, String artifactId, String goal, String type )
      throws DuplicateMojoDescriptorException, PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException, InvalidPluginDescriptorException {

   DefaultArtifact artifact = new DefaultArtifact( groupId, artifactId, "DUMMY", "compile", type, "", null );
   MojoDescriptor mojoDescriptor = new MojoDescriptor();
   mojoDescriptor.setGoal( goal );
   PluginDescriptor pluginDescriptor = new PluginDescriptor();
   pluginDescriptor.addMojo( mojoDescriptor );

   Plugin plugin = new Plugin();
   plugin.setGroupId( groupId );
   plugin.setArtifactId( artifactId );

   when( this.mojo.pluginManager.loadPlugin( eq( plugin ), anyList(), any( RepositorySystemSession.class ) ) ).thenReturn( pluginDescriptor );

   this.mojo.pluginDescriptor.getArtifactMap().put( String.format( "%s:%s", groupId, artifactId ), artifact );
}
 
开发者ID:ZsZs,项目名称:FitNesseLauncher,代码行数:19,代码来源:SetupsMojoTestHelper.java

示例8: create

import org.eclipse.aether.RepositorySystemSession; //导入依赖的package包/类
/**
 * Uses the passed Settings in order to configure and create the session
 * */
public RepositorySystemSession create(){
       DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();

       session.setOffline(settings.getOffline()!=null ? settings.getOffline().booleanValue() : false);
       session.setIgnoreArtifactDescriptorRepositories(true);
       
       session.setChecksumPolicy(RepositoryPolicy.CHECKSUM_POLICY_WARN);
       session.setUpdatePolicy(settings.getUpdatePolicy());
       
       LocalRepository localRepo = new LocalRepository(settings.getLocalRepository());
       session.setLocalRepositoryManager( repositorySystem.newLocalRepositoryManager( session, localRepo ) );

       session.setRepositoryListener( new microsofia.boot.aether.RepositoryListener() );
       session.setTransferListener( new microsofia.boot.aether.TransferListener() );

       /*TODO 	should allow the followig to be configured via settings file? (if needed)
        * 		session.setResolutionErrorPolicy();
       		session.setArtifactDescriptorPolicy(artifactDescriptorPolicy)
       		session.setSystemProperties(systemProperties)
       		session.setUserProperties(userProperties)
       		session.setConfigProperties(configProperties)*/
       
       return session;
   }
 
开发者ID:microsofia,项目名称:microsofia-boot,代码行数:28,代码来源:RepositorySystemSessionBuilder.java

示例9: dependencyArtifact

import org.eclipse.aether.RepositorySystemSession; //导入依赖的package包/类
public static Artifact dependencyArtifact( RepositorySystemSession repoSession, Dependency dependency )
{
    ArtifactTypeRegistry registry = ArtifactTypeRegistry.getDefaultRegistry();

    if ( repoSession != null && dependency.getType() != null )
    {
        ArtifactType type = repoSession.getArtifactTypeRegistry().get( dependency.getType() );

        if ( type != null )
        {
            registry =
                registry.registerStereotype( dependency.getType(), type.getExtension(), type.getClassifier() );
        }
    }

    return registry.createTypedArtifact( dependency.getGroupId(), dependency.getArtifactId(), dependency.getType(),
                                         dependency.getClassifier(), dependency.getVersion() );
}
 
开发者ID:fedora-java,项目名称:xmvn,代码行数:19,代码来源:Utils.java

示例10: resolve

import org.eclipse.aether.RepositorySystemSession; //导入依赖的package包/类
@Override
public PluginVersionResult resolve( PluginVersionRequest request )
{
    RepositorySystemSession session = request.getRepositorySession();
    WorkspaceReader reader = session.getWorkspaceReader();
    List<String> versions =
        reader.findVersions( new DefaultArtifact( request.getGroupId(), request.getArtifactId(),
                                                  Artifact.DEFAULT_EXTENSION, Artifact.DEFAULT_VERSION ) );
    final String version = versions.isEmpty() ? Artifact.DEFAULT_VERSION : versions.iterator().next();
    final ArtifactRepository repository = reader.getRepository();

    return new PluginVersionResult()
    {
        @Override
        public ArtifactRepository getRepository()
        {
            return repository;
        }

        @Override
        public String getVersion()
        {
            return version;
        }
    };
}
 
开发者ID:fedora-java,项目名称:xmvn,代码行数:27,代码来源:XMvnPluginVersionResolver.java

示例11: assertDependencyUpdated

import org.eclipse.aether.RepositorySystemSession; //导入依赖的package包/类
private void assertDependencyUpdated(final Artifact artifact, final String targetProject,
		final String expectedVersion, final String expectedBuildNumber) throws Exception {
	final RepositorySystemSession session = newRepositorySystemSession();
	final ArtifactDescriptorRequest descriptorRequest = new ArtifactDescriptorRequest();
	descriptorRequest.setArtifact(artifact);

	final ArtifactDescriptorResult descriptorResult = system.readArtifactDescriptor(session, descriptorRequest);

	Dependency targetDependency = null;
	for (final Dependency dep : descriptorResult.getDependencies()) {
		if (targetProject.equals(dep.getArtifact().getArtifactId())) {
			targetDependency = dep;
			break;
		}
	}

	assertNotNull(format("No dependency found with artifact-id %s", targetProject), targetDependency);
	assertEquals(format("%s%s", expectedVersion, expectedBuildNumber), targetDependency.getArtifact().getVersion());
}
 
开发者ID:SourcePond,项目名称:release-maven-plugin-parent,代码行数:20,代码来源:NestedModulesBaseTest.java

示例12: runMavenRequest

import org.eclipse.aether.RepositorySystemSession; //导入依赖的package包/类
public void runMavenRequest(MavenExecutionRequest request, Runnable runnable) {
  DefaultMaven maven = (DefaultMaven) getMavenComponent(Maven.class);
  RepositorySystemSession repositorySystemSession = maven.newRepositorySession(request);
  request.getProjectBuildingRequest().setRepositorySession(repositorySystemSession);
  MavenSession mavenSession =
      new MavenSession(
          container, repositorySystemSession, request, new DefaultMavenExecutionResult());
  LegacySupport legacySupport = getMavenComponent(LegacySupport.class);
  MavenSession previousSession = legacySupport.getSession();
  legacySupport.setSession(mavenSession);
  try {
    for (AbstractMavenLifecycleParticipant participant :
        getLifecycleParticipants(Collections.emptyList())) {
      participant.afterSessionStart(mavenSession);
    }
    runnable.run();
  } catch (MavenExecutionException e) {
    throw new RuntimeException(e);
  } finally {
    legacySupport.setSession(previousSession);
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:23,代码来源:MavenServerImpl.java

示例13: resolve

import org.eclipse.aether.RepositorySystemSession; //导入依赖的package包/类
private void resolve(
    Artifact artifact,
    List<ArtifactRepository> remoteRepositories,
    RepositorySystemSession session)
    throws ArtifactResolutionException, ArtifactNotFoundException {
  if (isModule(artifact)) {
    return;
  }
  try {
    resolveOrig(artifact, remoteRepositories, session);
  } catch (AbstractArtifactResolutionException e) {
    if (!failOnUnresolvedDependency) {
      artifact.setResolved(true);
    }
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:CheArtifactResolver.java

示例14: populateResult

import org.eclipse.aether.RepositorySystemSession; //导入依赖的package包/类
@Override
public void populateResult(RepositorySystemSession session,
	ArtifactDescriptorResult result,
	Model model) {
	super.populateResult(session, result, model);
	Parent parent = model.getParent();
	if (parent != null) {
		DefaultArtifact art =
			new DefaultArtifact(parent.getGroupId(),
				parent.getArtifactId(),
				"pom",
				parent.getVersion());
		Dependency dep = new Dependency(art, "compile");
		result.addDependency(dep);
	}
}
 
开发者ID:NixOS,项目名称:mvn2nix-maven-plugin,代码行数:17,代码来源:ParentPOMPropagatingArtifactDescriptorReaderDelegate.java

示例15: getSdk

import org.eclipse.aether.RepositorySystemSession; //导入依赖的package包/类
public static File getSdk(MavenProject project, RepositorySystem repoSystem, RepositorySystemSession repoSession, List<RemoteRepository>... repos)
    throws MojoExecutionException {
  Artifact artifact = (Artifact) find(project.getPluginArtifacts(), new Predicate<Artifact>() {
    @Override
    public boolean apply(Artifact artifact1) {
      return (artifact1.getArtifactId().equals("appengine-maven-plugin")
              && artifact1.getGroupId().equals("com.google.appengine"));
    }
  });

  String version = artifact.getVersion();

  if(version.endsWith("-SNAPSHOT")) {
    String newestVersion = determineNewestVersion(repoSystem, repoSession, repos);
    return getSdk(newestVersion, repoSystem, repoSession, repos);
  }

  return getSdk(version, repoSystem, repoSession, repos);
}
 
开发者ID:GoogleCloudPlatform,项目名称:appengine-maven-plugin,代码行数:20,代码来源:SdkResolver.java


注:本文中的org.eclipse.aether.RepositorySystemSession类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。