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


Java ProjectDependenciesResolver类代码示例

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


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

示例1: resolveDependencies

import org.apache.maven.project.ProjectDependenciesResolver; //导入依赖的package包/类
/**
 * copied from {@link DefaultProjectBuilder#resolveDependencies(MavenProject, RepositorySystemSession)}
 */
private DependencyResolutionResult resolveDependencies(MavenProject project, RepositorySystemSession session) {
  DependencyResolutionResult resolutionResult;

  try {
    ProjectDependenciesResolver dependencyResolver = getComponent(ProjectDependenciesResolver.class);
    DefaultDependencyResolutionRequest resolution = new DefaultDependencyResolutionRequest(project, session);
    resolutionResult = dependencyResolver.resolve(resolution);
  }
  catch (DependencyResolutionException e) {
    resolutionResult = e.getResult();
  }

  Set<Artifact> artifacts = new LinkedHashSet<Artifact>();
  if (resolutionResult.getDependencyGraph() != null) {
    RepositoryUtils.toArtifacts(artifacts, resolutionResult.getDependencyGraph().getChildren(),
                                Collections.singletonList(project.getArtifact().getId()), null);

    // Maven 2.x quirk: an artifact always points at the local repo, regardless whether resolved or not
    LocalRepositoryManager lrm = session.getLocalRepositoryManager();
    for (Artifact artifact : artifacts) {
      if (!artifact.isResolved()) {
        String path = lrm.getPathForLocalArtifact(RepositoryUtils.toArtifact(artifact));
        artifact.setFile(new File(lrm.getRepository().getBasedir(), path));
      }
    }
  }
  project.setResolvedArtifacts(artifacts);
  project.setArtifacts(artifacts);

  return resolutionResult;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:35,代码来源:Maven30ServerEmbedderImpl.java

示例2: resolveDependencies

import org.apache.maven.project.ProjectDependenciesResolver; //导入依赖的package包/类
/**
 * copied from {@link DefaultProjectBuilder#resolveDependencies(MavenProject, org.sonatype.aether.RepositorySystemSession)}
 */
private DependencyResolutionResult resolveDependencies(MavenProject project, RepositorySystemSession session) {
  DependencyResolutionResult resolutionResult;

  try {
    ProjectDependenciesResolver dependencyResolver = getComponent(ProjectDependenciesResolver.class);
    DefaultDependencyResolutionRequest resolution = new DefaultDependencyResolutionRequest(project, session);
    resolutionResult = dependencyResolver.resolve(resolution);
  }
  catch (DependencyResolutionException e) {
    resolutionResult = e.getResult();
  }

  Set<Artifact> artifacts = new LinkedHashSet<Artifact>();
  if (resolutionResult.getDependencyGraph() != null) {
    RepositoryUtils.toArtifacts(artifacts, resolutionResult.getDependencyGraph().getChildren(),
                                Collections.singletonList(project.getArtifact().getId()), null);

    // Maven 2.x quirk: an artifact always points at the local repo, regardless whether resolved or not
    LocalRepositoryManager lrm = session.getLocalRepositoryManager();
    for (Artifact artifact : artifacts) {
      if (!artifact.isResolved()) {
        String path = lrm.getPathForLocalArtifact(RepositoryUtils.toArtifact(artifact));
        artifact.setFile(new File(lrm.getRepository().getBasedir(), path));
      }
    }
  }
  project.setResolvedArtifacts(artifacts);
  project.setArtifacts(artifacts);

  return resolutionResult;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:35,代码来源:Maven32ServerEmbedderImpl.java

示例3: MavenOsgiUtils

import org.apache.maven.project.ProjectDependenciesResolver; //导入依赖的package包/类
public MavenOsgiUtils(MavenProject project, RepositorySystemSession repositorySystemSession,
		ProjectDependenciesResolver projectDependenciesResolver, Set<String> systemPackages,
		Log log) {
	this.project = project;
	this.repositorySystemSession = repositorySystemSession;
	this.projectDependenciesResolver = projectDependenciesResolver;
	this.systemPackages = systemPackages;
	this.log = log;
	javaPackages = Utils.getJavaPackages(log);
}
 
开发者ID:apache,项目名称:incubator-taverna-osgi,代码行数:11,代码来源:MavenOsgiUtils.java

示例4: LifecycleDependencyResolver

import org.apache.maven.project.ProjectDependenciesResolver; //导入依赖的package包/类
public LifecycleDependencyResolver( ProjectDependenciesResolver projectDependenciesResolver, Logger logger )
{
    this.dependenciesResolver = projectDependenciesResolver;
    this.logger = logger;
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:6,代码来源:LifecycleDependencyResolver.java


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