Package org.apache.maven.artifact.resolver

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


            if ( configuration.isResolveDependencies() )
            {
                Artifact artifact = new ProjectArtifact( project );

                ArtifactResolutionRequest artifactRequest = new ArtifactResolutionRequest()
                    .setArtifact( artifact )
                    .setResolveRoot( false )
                    .setResolveTransitively( true )
                    .setCache( configuration.getRepositoryCache() )
                    .setLocalRepository( configuration.getLocalRepository() )
                    .setRemoteRepositories( project.getRemoteArtifactRepositories() )
                    .setServers( configuration.getServers() )
                    .setMirrors( configuration.getMirrors() )
                    .setProxies( configuration.getProxies() )
                    .setOffline( configuration.isOffline() )
                    .setForceUpdate( configuration.isForceUpdate() )
                    .setManagedVersionMap( project.getManagedVersionMap() );
                artifactRequest.setTransferListener( configuration.getTransferListener() );

                artifactResult = repositorySystem.resolve( artifactRequest );

                project.setResolvedArtifacts( artifactResult.getArtifacts() );
                project.setArtifacts( artifactResult.getArtifacts() );
View Full Code Here


            artifact =
                repositorySystem.createProjectArtifact( artifact.getGroupId(), artifact.getArtifactId(),
                                                        artifact.getVersion() );
        }

        ArtifactResolutionRequest request = new ArtifactResolutionRequest()
            .setArtifact( artifact )
            .setCache( configuration.getRepositoryCache() )
            .setLocalRepository( configuration.getLocalRepository() )
            .setRemoteRepositories( configuration.getRemoteRepositories() )
            .setOffline( configuration.isOffline() )
            .setForceUpdate( configuration.isForceUpdate() );
        request.setTransferListener( configuration.getTransferListener() );

        ArtifactResolutionResult result = repositorySystem.resolve( request );

        if ( result.hasMissingArtifacts() && allowStubModel )
        {
View Full Code Here

        CumulativeScopeArtifactFilter resolutionScopeFilter = new CumulativeScopeArtifactFilter( scopesToResolve );

        CumulativeScopeArtifactFilter collectionScopeFilter = new CumulativeScopeArtifactFilter( scopesToCollect );
        collectionScopeFilter = new CumulativeScopeArtifactFilter( collectionScopeFilter, resolutionScopeFilter );

        ArtifactResolutionRequest request =
            new ArtifactResolutionRequest().setResolveRoot( false ).setResolveTransitively( true )
                .setCollectionFilter( collectionScopeFilter ).setResolutionFilter( resolutionScopeFilter )
                .setLocalRepository( session.getLocalRepository() ).setOffline( session.isOffline() )
                .setForceUpdate( session.getRequest().isUpdateSnapshots() ).setCache( session.getRepositoryCache() );
        request.setTransferListener( session.getRequest().getTransferListener() );
        request.setServers( session.getRequest().getServers() );
        request.setMirrors( session.getRequest().getMirrors() );
        request.setProxies( session.getRequest().getProxies() );

        for ( MavenProject project : projects )
        {
            request.setArtifact( new ProjectArtifact( project ) );
            request.setArtifactDependencies( project.getDependencyArtifacts() );
            request.setManagedVersionMap( project.getManagedVersionMap() );
            request.setRemoteRepositories( project.getRemoteArtifactRepositories() );

            ArtifactResolutionResult result = repositorySystem.resolve( request );

            try
            {
View Full Code Here

                                             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 );
    }
View Full Code Here

                            throw new ArtifactResolutionException( "Unable to get dependency information for "
                                + artifact.getId() + ": " + e.getMessage(), artifact, childRemoteRepositories, e );
                        }

                        ArtifactResolutionRequest subRequest = new ArtifactResolutionRequest( metadataRequest );
                        subRequest.setServers( request.getServers() );
                        subRequest.setMirrors( request.getMirrors() );
                        subRequest.setProxies( request.getProxies() );
                        recurse( result, child, resolvedArtifacts, managedVersions, subRequest, source, filter,
                                 listeners, conflictResolvers );
                    }
                }
                catch ( OverConstrainedVersionException e )
View Full Code Here

    }

    @VisibleForTesting
    String resolvePluginDependencyJarPath(Dependency dependency) {
        Artifact dependencyArtifact = repositorySystem.createArtifactWithClassifier(dependency.getGroupId(), dependency.getArtifactId(), dependency.getVersion(), dependency.getType(), dependency.getClassifier());
        artifactResolver.resolve(new ArtifactResolutionRequest().setArtifact(dependencyArtifact));
        return dependencyArtifact.getFile().getAbsolutePath();
    }
View Full Code Here

    }

    @VisibleForTesting
    String resolveJarWithDependenciesPath() {
        Artifact jarWithDependencies = repositorySystem.createArtifactWithClassifier("org.mock-server", "mockserver-netty", getVersion(), "jar", "jar-with-dependencies");
        artifactResolver.resolve(new ArtifactResolutionRequest().setArtifact(jarWithDependencies));
        return jarWithDependencies.getFile().getAbsolutePath();
    }
View Full Code Here

    this.mojo.project.getDependencyArtifacts().add(artifact);
    final ResolutionRequestForArtifact requestMatcher = new ResolutionRequestForArtifact(artifact);
    when(this.artifactResolver.resolve(argThat(requestMatcher))).thenAnswer(new Answer<ArtifactResolutionResult>() {
      @Override
      public ArtifactResolutionResult answer(InvocationOnMock invocation) throws Throwable {
        ArtifactResolutionRequest request = (ArtifactResolutionRequest)invocation.getArguments()[0];
            if(requestMatcher.matches(request)) {
                    return createArtifactResolutionResult(artifact, request.getCollectionFilter());
            }
            // Should never happen?
        return null;
      }
    });
View Full Code Here

         }
        return resolveArtifactTransitively(artifact);
    }

    private Set<Artifact> resolveArtifactTransitively(final Artifact artifact) {
        final ArtifactResolutionRequest request = new ArtifactResolutionRequest()
            .setArtifact( artifact )
      .setResolveRoot( true )
      .setResolveTransitively( true )
      .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));
View Full Code Here

        CumulativeScopeArtifactFilter resolutionScopeFilter = new CumulativeScopeArtifactFilter( scopesToResolve );

        CumulativeScopeArtifactFilter collectionScopeFilter = new CumulativeScopeArtifactFilter( scopesToCollect );
        collectionScopeFilter = new CumulativeScopeArtifactFilter( collectionScopeFilter, resolutionScopeFilter );

        ArtifactResolutionRequest request =
            new ArtifactResolutionRequest().setResolveRoot( false ).setResolveTransitively( true ).setCollectionFilter(
                collectionScopeFilter ).setResolutionFilter( resolutionScopeFilter ).setLocalRepository(
                session.getLocalRepository() ).setOffline( session.isOffline() ).setForceUpdate(
                session.getRequest().isUpdateSnapshots() );
        request.setServers( session.getRequest().getServers() );
        request.setMirrors( session.getRequest().getMirrors() );
        request.setProxies( session.getRequest().getProxies() );

        for ( MavenProject project : projects )
        {
            request.setArtifact( new ProjectArtifact( project ) );
            request.setArtifactDependencies( project.getDependencyArtifacts() );
            request.setManagedVersionMap( project.getManagedVersionMap() );
            request.setRemoteRepositories( project.getRemoteArtifactRepositories() );

            ArtifactResolutionResult result = repositorySystem.resolve( request );

            try
            {
View Full Code Here

TOP

Related Classes of org.apache.maven.artifact.resolver.ArtifactResolutionRequest

Copyright © 2018 www.massapicom. 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.