Examples of ArtifactResolutionResult


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

                        classpathElements.addAll( getProjectBuildOutputDirs( subProject ) );

                        Set<Artifact> dependencyArtifacts = subProject.createArtifacts( factory, null, null );
                        if ( !dependencyArtifacts.isEmpty() )
                        {
                            ArtifactResolutionResult result = null;
                            try
                            {
                                result = resolver.resolveTransitively( dependencyArtifacts, subProject.getArtifact(),
                                                                       subProject.getManagedVersionMap(),
                                                                       localRepository,
View Full Code Here

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

            MavenProject artifactProject =
                mavenProjectBuilder.buildFromRepository( artifact, remoteRepositories, localRepository );
            Set<Artifact> dependencyArtifacts = artifactProject.createArtifacts( factory, null, null );
            if ( !dependencyArtifacts.isEmpty() )
            {
                ArtifactResolutionResult result =
                    resolver.resolveTransitively( dependencyArtifacts, artifactProject.getArtifact(),
                                                  artifactProject.getRemoteArtifactRepositories(), localRepository,
                                                  artifactMetadataSource );
                Set<Artifact> artifacts = result.getArtifacts();

                Map<String, Artifact> compileArtifactMap = new HashMap<String, Artifact>();
                populateCompileArtifactMap( compileArtifactMap, artifacts );

                for ( Artifact a : compileArtifactMap.values() )
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

            // 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

        {
            listeners = new ArrayList();
            listeners.add(new RuntimeResolutionListener());
        }
       
        ArtifactResolutionResult result = artifactResolver.resolveTransitively(dependencyArtifacts, pomArtifact,
                Collections.EMPTY_MAP, localRepository, remoteRepositories, metadataSource, null, listeners);
       
        Set artifacts = result.getArtifacts();
       
        if (PluginLog.getLog().isDebugEnabled())
        {
            PluginLog.getLog().debug("RESOLVED "+artifacts.size()+" ARTIFACTS");
            Iterator itor = artifacts.iterator();
View Full Code Here

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

            Set dependencyArtifacts = project.getDependencyArtifacts();

            if (dependencyArtifacts == null) {
                dependencyArtifacts = project.createArtifacts(artifactFactory, null, null);
            }
            ArtifactResolutionResult result = artifactCollector.collect(dependencyArtifacts, project.getArtifact(), managedVersions, localRepository,
                    project.getRemoteArtifactRepositories(), artifactMetadataSource, null,
                    Collections.singletonList(listener));

            this.dependencyArtifacts = result.getArtifacts();
            rootNode = listener.getRootNode();
        }
        catch (ArtifactResolutionException exception) {
            throw new MojoExecutionException("Cannot build project dependency tree", exception);
        }
View Full Code Here

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

        ArtifactFactory factory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
        Artifact providerArtifact = factory.createExtensionArtifact( groupId, artifactId, versionRange );

        log( "Installing provider: " + providerArtifact );

        ArtifactResolutionResult result;
        try
        {
            MavenMetadataSource metadataSource = (MavenMetadataSource) lookup( ArtifactMetadataSource.ROLE );
            ArtifactResolver resolver = (ArtifactResolver) lookup( ArtifactResolver.ROLE );
            List remoteRepositories = createRemoteArtifactRepositories();

            result = resolver.resolveTransitively( Collections.singleton( providerArtifact ),
                                                   createDummyArtifact(), createLocalArtifactRepository(),
                                                   remoteRepositories, metadataSource, null );
        }
        catch ( ArtifactResolutionException e )
        {
            throw new BuildException( "Error downloading wagon provider from the remote repository: " + e.getMessage(),
                                      e );
        }
        catch ( ArtifactNotFoundException e )
        {
            throw new BuildException( "Unable to locate wagon provider in remote repository: " + e.getMessage(), e );
        }

        try
        {
            for ( Iterator i = result.getArtifacts().iterator(); i.hasNext(); )
            {
                Artifact a = (Artifact) i.next();

                getContainer().addJarResource( a.getFile() );
            }
View Full Code Here

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

            log( "There were no dependencies specified", Project.MSG_WARN );
        }

        log( "Resolving dependencies...", Project.MSG_VERBOSE );

        ArtifactResolutionResult result;
        Set artifacts;

        List remoteArtifactRepositories = createRemoteArtifactRepositories( pom.getRepositories() );

        try
        {
            artifacts = MavenMetadataSource.createArtifacts( artifactFactory, dependencies, null, null, null );

            Artifact pomArtifact = artifactFactory.createBuildArtifact( pom.getGroupId(), pom.getArtifactId(), pom
                .getVersion(), pom.getPackaging() );

            List listeners = Collections.singletonList( new AntResolutionListener( getProject(), verbose ) );

            // TODO: managed dependencies
            Map managedDependencies = Collections.EMPTY_MAP;

            ArtifactFilter filter = null;
            if ( useScope != null )
            {
                filter = new ScopeArtifactFilter( useScope );
            }
            if ( type != null )
            {
                TypeArtifactFilter typeArtifactFilter = new TypeArtifactFilter( type );
                if ( filter != null )
                {
                    AndArtifactFilter andFilter = new AndArtifactFilter();
                    andFilter.add( filter );
                    andFilter.add( typeArtifactFilter );
                    filter = andFilter;
                }
                else
                {
                    filter = typeArtifactFilter;
                }
            }

            result = resolver.resolveTransitively( artifacts, pomArtifact, managedDependencies, localRepo,
                                                   remoteArtifactRepositories, metadataSource, filter, listeners );
        }
        catch ( ArtifactResolutionException e )
        {
            throw new BuildException( "Unable to resolve artifact: " + e.getMessage(), e );
        }
        catch ( ArtifactNotFoundException e )
        {
            throw new BuildException( "Dependency not found: " + e.getMessage(), e );
        }
        catch ( InvalidDependencyVersionException e )
        {
            throw new BuildException( e.getMessage(), e );
        }

        /*
        MANTTASKS-37: Do what other ant tasks do and just override the path id.
        if ( pathId != null && getProject().getReference( pathId ) != null )
        {
            throw new BuildException( "Reference ID " + pathId + " already exists" );
        }

        if ( filesetId != null && getProject().getReference( filesetId ) != null )
        {
            throw new BuildException( "Reference ID " + filesetId + " already exists" );
        }

        if ( sourcesFilesetId != null && getProject().getReference( sourcesFilesetId ) != null )
        {
            throw new BuildException( "Reference ID " + sourcesFilesetId + " already exists" );
        }
        */

        FileList fileList = new FileList();
        fileList.setDir( getLocalRepository().getPath() );

        FileSet fileSet = new FileSet();
        fileSet.setProject( getProject() );
        fileSet.setDir( fileList.getDir( getProject() ) );

        FileSet sourcesFileSet = new FileSet();
        sourcesFileSet.setDir( getLocalRepository().getPath() );

        FileSet javadocsFileSet = new FileSet();
        javadocsFileSet.setDir( getLocalRepository().getPath() );

        Set versions = new HashSet();
       
        for ( Iterator i = result.getArtifacts().iterator(); i.hasNext(); )
        {
            Artifact artifact = (Artifact) i.next();

            addArtifactToResult( localRepo, artifact, fileSet, fileList );

View Full Code Here

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

    private Set<Artifact> getFilteredResolvedArtifacts( MavenProject project, Set<Artifact> artifacts,
                                                        ArtifactFilter filter )
    {
        try
        {
            ArtifactResolutionResult result =
                resolver.resolveTransitively( artifacts, project.getArtifact(), localRepository, remoteRepositories,
                                              metadataSource, filter );

            @SuppressWarnings( "unchecked" )
            Set<Artifact> resolvedArtifacts = result.getArtifacts();

            return resolvedArtifacts;
        }
        catch ( ArtifactResolutionException e )
        {
View Full Code Here

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

    {
        ArtifactSpec a = createArtifactSpec( "a", "1.0" );

        ArtifactSpec b = createArtifactSpec( "b", "1.0", true );

        ArtifactResolutionResult res = collect( createSet( new Object[] { a.artifact, b.artifact } ) );
        assertEquals( "Check artifact list", createSet( new Object[] { a.artifact, b.artifact } ), res.getArtifacts() );
    }
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.