本文整理汇总了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;
}
示例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;
}
示例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);
}
示例4: LifecycleDependencyResolver
import org.apache.maven.project.ProjectDependenciesResolver; //导入依赖的package包/类
public LifecycleDependencyResolver( ProjectDependenciesResolver projectDependenciesResolver, Logger logger )
{
this.dependenciesResolver = projectDependenciesResolver;
this.logger = logger;
}