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


Java ResolutionListener类代码示例

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


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

示例1: resolveProject

import org.apache.maven.artifact.resolver.ResolutionListener; //导入依赖的package包/类
@NotNull
public MavenServerExecutionResult resolveProject(@NotNull final File file,
                                                 @NotNull final Collection<String> activeProfiles,
                                                 @NotNull final Collection<String> inactiveProfiles)
  throws MavenServerProcessCanceledException, RemoteException {
  return doExecute(new Executor<MavenServerExecutionResult>() {
    public MavenServerExecutionResult execute() throws Exception {
      DependencyTreeResolutionListener listener = new DependencyTreeResolutionListener(myConsoleWrapper);
      MavenExecutionResult result = myImpl.resolveProject(file,
                                                          new ArrayList<String>(activeProfiles),
                                                          new ArrayList<String>(inactiveProfiles),
                                                          Arrays.<ResolutionListener>asList(listener));
      return createExecutionResult(file, result, listener.getRootNode());
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:Maven2ServerEmbedderImpl.java

示例2: resolveTransitively

import org.apache.maven.artifact.resolver.ResolutionListener; //导入依赖的package包/类
public ArtifactResolutionResult resolveTransitively(
    Set<Artifact> artifacts,
    Artifact originatingArtifact,
    List<ArtifactRepository> remoteRepositories,
    ArtifactRepository localRepository,
    ArtifactMetadataSource source,
    List<ResolutionListener> listeners)
    throws ArtifactResolutionException, ArtifactNotFoundException {
  return resolveTransitively(
      artifacts,
      originatingArtifact,
      Collections.EMPTY_MAP,
      localRepository,
      remoteRepositories,
      source,
      null,
      listeners);
}
 
开发者ID:eclipse,项目名称:che,代码行数:19,代码来源:CheArtifactResolver.java

示例3: collect

import org.apache.maven.artifact.resolver.ResolutionListener; //导入依赖的package包/类
public ArtifactResolutionResult collect( Set<Artifact> artifacts, Artifact originatingArtifact,
                                         Map managedVersions, ArtifactRepository localRepository,
                                         List<ArtifactRepository> remoteRepositories,
                                         ArtifactMetadataSource source, ArtifactFilter filter,
                                         List<ResolutionListener> listeners,
                                         List<ConflictResolver> conflictResolvers )
{
    ArtifactResolutionRequest request = new ArtifactResolutionRequest();
    request.setLocalRepository( localRepository );
    request.setRemoteRepositories( remoteRepositories );
    injectSession( request );
    return collect( artifacts, originatingArtifact, managedVersions, request, source, filter, listeners,
                    conflictResolvers );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:15,代码来源:DefaultLegacyArtifactCollector.java

示例4: checkScopeUpdate

import org.apache.maven.artifact.resolver.ResolutionListener; //导入依赖的package包/类
private void checkScopeUpdate(ResolutionNode farthest,
        ResolutionNode nearest, List listeners) {
    boolean updateScope = false;
    Artifact farthestArtifact = farthest.getArtifact();
    Artifact nearestArtifact = nearest.getArtifact();

    if (Artifact.SCOPE_RUNTIME.equals(farthestArtifact.getScope())
            && (Artifact.SCOPE_TEST.equals(nearestArtifact.getScope()) || Artifact.SCOPE_PROVIDED
            .equals(nearestArtifact.getScope()))) {
        updateScope = true;
    }

    if (Artifact.SCOPE_COMPILE.equals(farthestArtifact.getScope())
            && !Artifact.SCOPE_COMPILE.equals(nearestArtifact.getScope())) {
        updateScope = true;
    }

    // current POM rules all
    if (nearest.getDepth() < 2 && updateScope) {
        updateScope = false;

        fireEvent(ResolutionListener.UPDATE_SCOPE_CURRENT_POM, listeners,
                nearest, farthestArtifact);
    }

    if (updateScope) {
        fireEvent(ResolutionListener.UPDATE_SCOPE, listeners, nearest,
                farthestArtifact);

        // previously we cloned the artifact, but it is more effecient to
        // just update the scope
        // if problems are later discovered that the original object needs
        // its original scope value, cloning may
        // again be appropriate
        nearestArtifact.setScope(farthestArtifact.getScope());
    }
}
 
开发者ID:hitakaken,项目名称:bigfoot-maven-plugins,代码行数:38,代码来源:GraphArtifactCollector.java

示例5: resolveProject

import org.apache.maven.artifact.resolver.ResolutionListener; //导入依赖的package包/类
@NotNull
public MavenServerExecutionResult resolveProject(@NotNull final File file,
                                                  @NotNull final Collection<String> activeProfiles)
  throws MavenServerProcessCanceledException, RemoteException {
  return doExecute(new Executor<MavenServerExecutionResult>() {
    public MavenServerExecutionResult execute() throws Exception {
      DependencyTreeResolutionListener listener = new DependencyTreeResolutionListener(myConsoleWrapper);
      MavenExecutionResult result = myImpl.resolveProject(file,
                                                          new ArrayList<String>(activeProfiles),
                                                          Arrays.<ResolutionListener>asList(listener));
      return createExecutionResult(file, result, listener.getRootNode());
    }
  });
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:15,代码来源:Maven2ServerEmbedderImpl.java

示例6: manageArtifact

import org.apache.maven.artifact.resolver.ResolutionListener; //导入依赖的package包/类
private void manageArtifact( ResolutionNode node, ManagedVersionMap managedVersions,
                             List<ResolutionListener> listeners )
{
    Artifact artifact = (Artifact) managedVersions.get( node.getKey() );

    // Before we update the version of the artifact, we need to know
    // whether we are working on a transitive dependency or not. This
    // allows depMgmt to always override transitive dependencies, while
    // explicit child override depMgmt (viz. depMgmt should only
    // provide defaults to children, but should override transitives).
    // We can do this by calling isChildOfRootNode on the current node.

    if ( ( artifact.getVersion() != null )
        && ( !node.isChildOfRootNode() || node.getArtifact().getVersion() == null ) )
    {
        fireEvent( ResolutionListener.MANAGE_ARTIFACT_VERSION, listeners, node, artifact );
        node.getArtifact().setVersion( artifact.getVersion() );
    }

    if ( ( artifact.getScope() != null ) && ( !node.isChildOfRootNode() || node.getArtifact().getScope() == null ) )
    {
        fireEvent( ResolutionListener.MANAGE_ARTIFACT_SCOPE, listeners, node, artifact );
        node.getArtifact().setScope( artifact.getScope() );
    }

    if ( Artifact.SCOPE_SYSTEM.equals( node.getArtifact().getScope() ) && ( node.getArtifact().getFile() == null )
        && ( artifact.getFile() != null ) )
    {
        fireEvent( ResolutionListener.MANAGE_ARTIFACT_SYSTEM_PATH, listeners, node, artifact );
        node.getArtifact().setFile( artifact.getFile() );
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:33,代码来源:DefaultLegacyArtifactCollector.java

示例7: internalResolveProject

import org.apache.maven.artifact.resolver.ResolutionListener; //导入依赖的package包/类
private MavenResult internalResolveProject(
    File pom,
    List<String> activeProfiles,
    List<String> inactiveProfiles,
    List<ResolutionListener> dependencyTreeResolutionListeners) {

  MavenExecutionRequest request =
      newMavenRequest(pom, activeProfiles, inactiveProfiles, Collections.emptyList());
  request.setUpdateSnapshots(updateSnapshots);

  AtomicReference<MavenResult> reference = new AtomicReference<>();
  runMavenRequest(
      request,
      () -> {
        try {
          ProjectBuilder builder = getMavenComponent(ProjectBuilder.class);

          List<ProjectBuildingResult> resultList =
              builder.build(
                  Collections.singletonList(pom), false, request.getProjectBuildingRequest());
          ProjectBuildingResult result = resultList.get(0);
          MavenProject mavenProject = result.getProject();
          RepositorySystemSession repositorySession =
              getMavenComponent(LegacySupport.class).getRepositorySession();
          if (repositorySession instanceof DefaultRepositorySystemSession) {
            ((DefaultRepositorySystemSession) repositorySession)
                .setTransferListener(new ArtifactTransferListener(mavenProgressNotifier));
            if (workspaceCache != null) {
              ((DefaultRepositorySystemSession) repositorySession)
                  .setWorkspaceReader(new MavenWorkspaceReader(workspaceCache));
            }
          }

          List<Exception> exceptions = new ArrayList<>();

          loadExtensions(mavenProject, exceptions);
          mavenProject.setDependencyArtifacts(
              mavenProject.createArtifacts(getMavenComponent(ArtifactFactory.class), null, null));

          ArtifactResolutionRequest resolutionRequest = new ArtifactResolutionRequest();
          resolutionRequest.setArtifact(mavenProject.getArtifact());
          resolutionRequest.setRemoteRepositories(mavenProject.getRemoteArtifactRepositories());
          resolutionRequest.setArtifactDependencies(mavenProject.getDependencyArtifacts());
          resolutionRequest.setListeners(dependencyTreeResolutionListeners);
          resolutionRequest.setLocalRepository(localRepo);
          resolutionRequest.setManagedVersionMap(mavenProject.getManagedVersionMap());
          resolutionRequest.setResolveTransitively(true);
          resolutionRequest.setResolveRoot(false);
          ArtifactResolver resolver = getMavenComponent(ArtifactResolver.class);
          ArtifactResolutionResult resolve = resolver.resolve(resolutionRequest);
          mavenProject.setArtifacts(resolve.getArtifacts());
          reference.set(new MavenResult(mavenProject, exceptions));

        } catch (Exception e) {
          reference.set(new MavenResult(null, null, Collections.singletonList(e)));
        }
      });
  return reference.get();
}
 
开发者ID:eclipse,项目名称:che,代码行数:60,代码来源:MavenServerImpl.java

示例8: fireEvent

import org.apache.maven.artifact.resolver.ResolutionListener; //导入依赖的package包/类
private void fireEvent(int event, List listeners, ResolutionNode node,
        Artifact replacement, VersionRange newRange) {
    for (Iterator i = listeners.iterator(); i.hasNext();) {
        ResolutionListener listener = (ResolutionListener) i.next();

        switch (event) {
            case ResolutionListener.TEST_ARTIFACT:
                listener.testArtifact(node.getArtifact());
                break;
            case ResolutionListener.PROCESS_CHILDREN:
                listener.startProcessChildren(node.getArtifact());
                break;
            case ResolutionListener.FINISH_PROCESSING_CHILDREN:
                listener.endProcessChildren(node.getArtifact());
                break;
            case ResolutionListener.INCLUDE_ARTIFACT:
                listener.includeArtifact(node.getArtifact());
                break;
            case ResolutionListener.OMIT_FOR_NEARER:
                String version = node.getArtifact().getVersion();
                String replacementVersion = replacement.getVersion();
                if (version != null ? !version.equals(replacementVersion)
                        : replacementVersion != null) {
                    listener.omitForNearer(node.getArtifact(), replacement);
                }
                break;
            case ResolutionListener.OMIT_FOR_CYCLE:
                listener.omitForCycle(node.getArtifact());
                break;
            case ResolutionListener.UPDATE_SCOPE:
                listener
                        .updateScope(node.getArtifact(), replacement.getScope());
                break;
            case ResolutionListener.UPDATE_SCOPE_CURRENT_POM:
                listener.updateScopeCurrentPom(node.getArtifact(), replacement
                        .getScope());
                break;
            case ResolutionListener.MANAGE_ARTIFACT:
                listener.manageArtifact(node.getArtifact(), replacement);
                break;
            case ResolutionListener.SELECT_VERSION_FROM_RANGE:
                listener.selectVersionFromRange(node.getArtifact());
                break;
            case ResolutionListener.RESTRICT_RANGE:
                if (node.getArtifact().getVersionRange().hasRestrictions()
                        || replacement.getVersionRange().hasRestrictions()) {
                    listener.restrictRange(node.getArtifact(), replacement,
                            newRange);
                }
                break;
            default:
                throw new IllegalStateException("Unknown event: " + event);
        }
    }
}
 
开发者ID:hitakaken,项目名称:bigfoot-maven-plugins,代码行数:56,代码来源:GraphArtifactCollector.java

示例9: checkScopeUpdate

import org.apache.maven.artifact.resolver.ResolutionListener; //导入依赖的package包/类
/**
 * Check if the artifactScope needs to be updated. <a
 * href="http://docs.codehaus.org/x/IGU#DependencyMediationandConflictResolution-Scoperesolution">More info</a>.
 *
 * @param farthest farthest resolution node
 * @param nearest nearest resolution node
 * @param listeners
 */
boolean checkScopeUpdate( ResolutionNode farthest, ResolutionNode nearest, List<ResolutionListener> listeners )
{
    boolean updateScope = false;
    Artifact farthestArtifact = farthest.getArtifact();
    Artifact nearestArtifact = nearest.getArtifact();

    /* farthest is runtime and nearest has lower priority, change to runtime */
    if ( Artifact.SCOPE_RUNTIME.equals( farthestArtifact.getScope() )
        && ( Artifact.SCOPE_TEST.equals( nearestArtifact.getScope() )
                        || Artifact.SCOPE_PROVIDED.equals( nearestArtifact.getScope() ) ) )
    {
        updateScope = true;
    }

    /* farthest is compile and nearest is not (has lower priority), change to compile */
    if ( Artifact.SCOPE_COMPILE.equals( farthestArtifact.getScope() )
        && !Artifact.SCOPE_COMPILE.equals( nearestArtifact.getScope() ) )
    {
        updateScope = true;
    }

    /* current POM rules all, if nearest is in current pom, do not update its artifactScope */
    if ( ( nearest.getDepth() < 2 ) && updateScope )
    {
        updateScope = false;

        fireEvent( ResolutionListener.UPDATE_SCOPE_CURRENT_POM, listeners, nearest, farthestArtifact );
    }

    if ( updateScope )
    {
        fireEvent( ResolutionListener.UPDATE_SCOPE, listeners, nearest, farthestArtifact );

        // previously we cloned the artifact, but it is more effecient to just update the artifactScope
        // if problems are later discovered that the original object needs its original artifactScope value, cloning
        // may
        // again be appropriate
        nearestArtifact.setScope( farthestArtifact.getScope() );
    }

    return updateScope;
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:51,代码来源:DefaultLegacyArtifactCollector.java

示例10: fireEvent

import org.apache.maven.artifact.resolver.ResolutionListener; //导入依赖的package包/类
private void fireEvent( int event, List<ResolutionListener> listeners, ResolutionNode node )
{
    fireEvent( event, listeners, node, null );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:5,代码来源:DefaultLegacyArtifactCollector.java

示例11: collect

import org.apache.maven.artifact.resolver.ResolutionListener; //导入依赖的package包/类
ArtifactResolutionResult collect( Set<Artifact> artifacts, Artifact originatingArtifact, Map managedVersions,
ArtifactResolutionRequest repositoryRequest, ArtifactMetadataSource source,
ArtifactFilter filter, List<ResolutionListener> listeners,
List<ConflictResolver> conflictResolvers );
 
开发者ID:gems-uff,项目名称:oceano,代码行数:5,代码来源:LegacyArtifactCollector.java


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