Examples of ArtifactResolutionResult


Examples of org.apache.maven.artifact.resolver.ArtifactResolutionResult

        }
       
        Set resolvedArtifacts;
        try
        {
            ArtifactResolutionResult result = artifactResolver.resolveTransitively( project.getDependencyArtifacts(),
                                                                                artifact,
                                                                                project.getManagedVersionMap(),
                                                                                context.getLocalRepository(),
                                                                                project.getRemoteArtifactRepositories(),
                                                                                artifactMetadataSource, filter );
            resolvedArtifacts = result.getArtifacts();
        }
        catch (MultipleArtifactsNotFoundException me)
        {
            /*only do this if we are an aggregating plugin: MNG-2277
            if the dependency doesn't yet exist but is in the reactor, then
View Full Code Here

Examples of org.apache.maven.artifact.resolver.ArtifactResolutionResult

    private Classpath getArtifactClasspath( Artifact surefireArtifact )
    {
        Classpath existing = ClasspathCache.getCachedClassPath( surefireArtifact.getArtifactId() );
        if ( existing == null )
        {
            ArtifactResolutionResult result = resolveArtifact( null, surefireArtifact );

            List<String> items = new ArrayList<String>();
            for ( Object o : result.getArtifacts() )
            {
                Artifact artifact = (Artifact) o;

                getLog().debug(
                    "Adding to " + getPluginName() + " booter test classpath: " + artifact.getFile().getAbsolutePath() +
View Full Code Here

Examples of org.apache.maven.artifact.resolver.ArtifactResolutionResult

        {
            Artifact providerArtifact = artifactFactory.createDependencyArtifact( "org.apache.maven.surefire", provider,
                                                                                  VersionRange.createFromVersion(
                                                                                      version ), "jar", null,
                                                                                  Artifact.SCOPE_TEST );
            ArtifactResolutionResult result = resolveArtifact( filteredArtifact, providerArtifact );
            List<String> files = new ArrayList<String>();

            for ( Object o : result.getArtifacts() )
            {
                Artifact artifact = (Artifact) o;

                log.debug(
                    "Adding to " + pluginName + " test classpath: " + artifact.getFile().getAbsolutePath() + " Scope: "
View Full Code Here

Examples of org.apache.maven.artifact.resolver.ArtifactResolutionResult

        throws ArtifactResolutionException, ArtifactNotFoundException
    {
        List<String> files = new ArrayList<String>();
        if ( surefireArtifact != null )
        {
            final ArtifactResolutionResult artifactResolutionResult = resolveArtifact( null, surefireArtifact );
            for ( Artifact artifact : pluginArtifactMap.values() )
            {
                if ( !artifactResolutionResult.getArtifacts().contains( artifact ) )
                {
                    files.add( artifact.getFile().getAbsolutePath() );
                }
            }
        }
View Full Code Here

Examples of org.apache.maven.artifact.resolver.ArtifactResolutionResult

            // not forgetting the Artifact of the project itself
            dependencyArtifacts.add(executableProject.getArtifact());

            // resolve all dependencies transitively to obtain a comprehensive
            // list of assemblies
            ArtifactResolutionResult result = artifactResolver.resolveTransitively(dependencyArtifacts, executablePomArtifact, Collections.EMPTY_MAP, this.localRepository, this.remoteRepositories,
                                                                                   metadataSource, null, Collections.EMPTY_LIST);
            executableDependencies = result.getArtifacts();

        } catch (Exception ex) {
            throw new MojoExecutionException("Encountered problems resolving dependencies of the executable " + "in preparation for its execution.", ex);
        }
View Full Code Here

Examples of org.apache.maven.artifact.resolver.ArtifactResolutionResult

            // not forgetting the Artifact of the project itself
            dependencyArtifacts.add(executableProject.getArtifact());

            // resolve all dependencies transitively to obtain a comprehensive
            // list of assemblies
            ArtifactResolutionResult result = artifactResolver.resolveTransitively(dependencyArtifacts,
                                                                                   executablePomArtifact,
                                                                                   Collections.EMPTY_MAP,
                                                                                   this.localRepository,
                                                                                   this.remoteRepositories,
                                                                                   metadataSource, null,
                                                                                   Collections.EMPTY_LIST);
            executableDependencies = CastUtils.cast(result.getArtifacts());

        } catch (Exception ex) {
            throw new MojoExecutionException("Encountered problems resolving dependencies of the executable "
                                             + "in preparation for its execution.", ex);
        }
View Full Code Here

Examples of org.apache.maven.artifact.resolver.ArtifactResolutionResult

        if (project.getDependencyArtifacts() == null) {
            project.setDependencyArtifacts(project.createArtifacts(artifactFactory, null, null));
        }

        ArtifactResolutionResult artifactResolutionResult = dependencyHelper.getArtifactCollector().collect(
                project.getDependencyArtifacts(),
                project.getArtifact(),
                managedVersions,
                getArtifactRepository(),
                project.getRemoteArtifactRepositories(),
                dependencyHelper.getArtifactMetadataSource(),
                null,
                Collections.emptyList());

        dependencies = artifactResolutionResult.getArtifacts();
    }
View Full Code Here

Examples of org.apache.maven.artifact.resolver.ArtifactResolutionResult

        final MavenProject project = configSource.getProject();

        final ArtifactFilter filter = info.getScopeFilter();
        final ArtifactRepository localRepository = configSource.getLocalRepository();

        ArtifactResolutionResult result;
        try
        {
            result =
                resolver.resolveTransitively( dependencyArtifacts, project.getArtifact(),
                                              project.getManagedVersionMap(), localRepository, repos, metadataSource,
                                              filter );
        }
        catch ( final ArtifactResolutionException e )
        {
            throw new DependencyResolutionException( "Failed to resolve dependencies for assembly: ", e );
        }
        catch ( final ArtifactNotFoundException e )
        {
            throw new DependencyResolutionException( "Failed to resolve dependencies for assembly: ", e );
        }

        getLogger().debug( "While resolving dependencies of " + project.getId() + ":" );

        FilterUtils.reportFilteringStatistics( Collections.singleton( filter ), getLogger() );

        return result.getArtifacts();
    }
View Full Code Here

Examples of org.apache.maven.artifact.resolver.ArtifactResolutionResult

      .setRemoteRepositories( this.remoteArtifactRepositories )
      .setLocalRepository( this.localRepository );
        if(this.excludeOptionalDependencies) {
      request.setCollectionFilter(OptionalArtifactFilter.INSTANCE);
        }
    final ArtifactResolutionResult result = this.resolver.resolve(request);
        if(!result.isSuccess()) {
            for(Artifact missing : result.getMissingArtifacts()) {
          getLog().error(String.format("Could not resolve artifact: [%s]", missing));
          }
          if(result.hasExceptions() && getLog().isDebugEnabled()) {
              for(Exception exception : result.getExceptions()) {
              getLog().debug(exception);
              }
          }
        }
       final Set<Artifact> dependencies = result.getArtifacts();
    return dependencies;
    }
View Full Code Here

Examples of org.apache.maven.artifact.resolver.ArtifactResolutionResult

  }
 
  private ArtifactResolutionResult createArtifactResolutionResult(
      Collection<Artifact> artifacts, List<Artifact> missingArtifacts,
      ArtifactResolutionException exception, ArtifactFilter filter) {
    ArtifactResolutionResult result = new ArtifactResolutionResult();
    Set<Artifact> strippedArtifacts = new HashSet<Artifact>(artifacts);
    if(OptionalArtifactFilter.INSTANCE.equals(filter)) {
        Iterator<Artifact> artifactItr = strippedArtifacts.iterator();
        while(artifactItr.hasNext()) {
          boolean include = OptionalArtifactFilter.INSTANCE.include(artifactItr.next());
          if(!include) {
            artifactItr.remove();
          }
      }
    }
    result.setArtifacts(new HashSet<Artifact>(strippedArtifacts));
    if(missingArtifacts != null) {
      result.setUnresolvedArtifacts(missingArtifacts);
    }
    if(exception != null) {
      result.addErrorArtifactException(exception);
    }
    return result;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.