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


Java MavenProjectBuilder.calculateConcreteState方法代码示例

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


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

示例1: resolveProject

import org.apache.maven.project.MavenProjectBuilder; //导入方法依赖的package包/类
@NotNull
public MavenExecutionResult resolveProject(@NotNull final File file,
                                           @NotNull final List<String> activeProfiles,
                                           @NotNull final List<String> inactiveProfiles,
                                           List<ResolutionListener> listeners) {
  MavenExecutionRequest request = createRequest(file, activeProfiles, inactiveProfiles, Collections.<String>emptyList());
  ProjectBuilderConfiguration config = request.getProjectBuilderConfiguration();

  request.getGlobalProfileManager().loadSettingsProfiles(mySettings);

  ProfileManager globalProfileManager = request.getGlobalProfileManager();
  globalProfileManager.loadSettingsProfiles(request.getSettings());

  List<Exception> exceptions = new ArrayList<Exception>();
  MavenProject project = null;
  try {
    // copied from DefaultMavenProjectBuilder.buildWithDependencies
    MavenProjectBuilder builder = getComponent(MavenProjectBuilder.class);
    project = builder.build(new File(file.getPath()), config);
    builder.calculateConcreteState(project, config, false);

    // copied from DefaultLifecycleExecutor.execute
    findExtensions(project);
    // end copied from DefaultLifecycleExecutor.execute

    Artifact projectArtifact = project.getArtifact();
    Map managedVersions = project.getManagedVersionMap();
    ArtifactMetadataSource metadataSource = getComponent(ArtifactMetadataSource.class);
    project.setDependencyArtifacts(project.createArtifacts(getComponent(ArtifactFactory.class), null, null));

    ArtifactResolver resolver = getComponent(ArtifactResolver.class);
    ArtifactResolutionResult result = resolver
      .resolveTransitively(project.getDependencyArtifacts(), projectArtifact, managedVersions, myLocalRepository,
                           project.getRemoteArtifactRepositories(), metadataSource, null, listeners);
    project.setArtifacts(result.getArtifacts());
    // end copied from DefaultMavenProjectBuilder.buildWithDependencies
  }
  catch (Exception e) {
    return handleException(e);
  }

  return new MavenExecutionResult(project, exceptions);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:44,代码来源:MavenEmbedder.java

示例2: resolveProject

import org.apache.maven.project.MavenProjectBuilder; //导入方法依赖的package包/类
@NotNull
public MavenExecutionResult resolveProject(@NotNull final File file,
                                           @NotNull final List<String> activeProfiles,
                                           List<ResolutionListener> listeners) {
  MavenExecutionRequest request = createRequest(file, activeProfiles, Collections.<String>emptyList(), Collections.<String>emptyList());
  ProjectBuilderConfiguration config = request.getProjectBuilderConfiguration();

  request.getGlobalProfileManager().loadSettingsProfiles(mySettings);

  ProfileManager globalProfileManager = request.getGlobalProfileManager();
  globalProfileManager.loadSettingsProfiles(request.getSettings());

  List<Exception> exceptions = new ArrayList<Exception>();
  MavenProject project = null;
  try {
    // copied from DefaultMavenProjectBuilder.buildWithDependencies
    MavenProjectBuilder builder = getComponent(MavenProjectBuilder.class);
    project = builder.build(new File(file.getPath()), config);
    builder.calculateConcreteState(project, config, false);

    // copied from DefaultLifecycleExecutor.execute
    findExtensions(project);
    // end copied from DefaultLifecycleExecutor.execute

    Artifact projectArtifact = project.getArtifact();
    Map managedVersions = project.getManagedVersionMap();
    ArtifactMetadataSource metadataSource = getComponent(ArtifactMetadataSource.class);
    project.setDependencyArtifacts(project.createArtifacts(getComponent(ArtifactFactory.class), null, null));

    ArtifactResolver resolver = getComponent(ArtifactResolver.class);
    ArtifactResolutionResult result = resolver
      .resolveTransitively(project.getDependencyArtifacts(), projectArtifact, managedVersions, myLocalRepository,
                           project.getRemoteArtifactRepositories(), metadataSource, null, listeners);
    project.setArtifacts(result.getArtifacts());
    // end copied from DefaultMavenProjectBuilder.buildWithDependencies
  }
  catch (Exception e) {
    return handleException(e);
  }

  return new MavenExecutionResult(project, exceptions);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:43,代码来源:MavenEmbedder.java


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