Package org.apache.maven.plugin.dependency.utils

Examples of org.apache.maven.plugin.dependency.utils.DependencyStatusSets


        project.setArtifacts( artifacts );
        project.setDependencyArtifacts( directArtifacts );

        mojo.execute();
        DependencyStatusSets results = mojo.getResults();
        assertNotNull( results );
        assertEquals( artifacts.size(), results.getResolvedDependencies().size() );

        setVariableValueToObject( mojo, "excludeTransitive", Boolean.TRUE );

        mojo.execute();
        results = mojo.getResults();
        assertNotNull( results );
        assertEquals( directArtifacts.size(), results.getResolvedDependencies().size() );
    }
View Full Code Here


     *      Log)
     */
    protected void doExecute()
        throws MojoExecutionException
    {
        DependencyStatusSets dss = getDependencySets( this.failOnMissingClassifierArtifact );

        for ( Artifact artifact : dss.getResolvedDependencies() )
        {
            File destDir;
            destDir = DependencyUtil.getFormattedOutputDirectory( useSubDirectoryPerScope, useSubDirectoryPerType,
                                                                  useSubDirectoryPerArtifact, useRepositoryLayout,
                                                                  stripVersion, outputDirectory, artifact );
            unpack( artifact, destDir, getIncludes(), getExcludes() );
            DefaultFileMarkerHandler handler = new DefaultFileMarkerHandler( artifact, this.markersDirectory );
            handler.setMarker();
        }

        for ( Artifact artifact : dss.getSkippedDependencies() )
        {
            getLog().info( artifact.getFile().getName() + " already exists in destination." );
        }
    }
View Full Code Here

     * @see #copyArtifact(Artifact, boolean)
     */
    protected void doExecute()
        throws MojoExecutionException
    {
        DependencyStatusSets dss = getDependencySets( this.failOnMissingClassifierArtifact );
        Set<Artifact> artifacts = dss.getResolvedDependencies();

        if ( !useRepositoryLayout )
        {
            for ( Artifact artifact : artifacts )
            {
                copyArtifact( artifact, isStripVersion(), this.prependGroupId, this.useBaseVersion );
            }
        }
        else
        {
            try
            {
                ArtifactRepository targetRepository =
                    repositoryFactory.createDeploymentArtifactRepository( "local",
                                                                          outputDirectory.toURL().toExternalForm(),
                                                                          repositoryLayouts.get( "default" ),
                                                                          false /* uniqueVersion */);
                for ( Artifact artifact : artifacts )
                {
                    installArtifact( artifact, targetRepository );
                }
            }
            catch ( MalformedURLException e )
            {
                throw new MojoExecutionException( "Could not create outputDirectory repository", e );
            }
        }

        Set<Artifact> skippedArtifacts = dss.getSkippedDependencies();
        for ( Artifact artifact : skippedArtifacts )
        {
            getLog().info( artifact.getFile().getName() + " already exists in destination." );
        }

View Full Code Here

     */
    protected Set<Artifact> getResolvedDependencies( boolean stopOnFailure )
        throws MojoExecutionException

    {
        DependencyStatusSets status = getDependencySets( stopOnFailure );

        return status.getResolvedDependencies();
    }
View Full Code Here

        {
            throw new MojoExecutionException( e.getMessage(), e );
        }

        // transform artifacts if classifier is set
        DependencyStatusSets status = null;
        if ( StringUtils.isNotEmpty( classifier ) )
        {
            status = getClassifierTranslatedDependencies( artifacts, stopOnFailure );
        }
        else
View Full Code Here

    protected DependencyStatusSets getClassifierTranslatedDependencies( Set<Artifact> artifacts, boolean stopOnFailure )
        throws MojoExecutionException
    {
        Set<Artifact> unResolvedArtifacts = new HashSet<Artifact>();
        Set<Artifact> resolvedArtifacts = artifacts;
        DependencyStatusSets status = new DependencyStatusSets();

        // possibly translate artifacts into a new set of artifacts based on the
        // classifier and type
        // if this did something, we need to resolve the new artifacts
        if ( StringUtils.isNotEmpty( classifier ) )
        {
            ArtifactTranslator translator = new ClassifierTypeTranslator( this.classifier, this.type, this.factory );
            artifacts = translator.translate( artifacts, getLog() );

            status = filterMarkedDependencies( artifacts );

            // the unskipped artifacts are in the resolved set.
            artifacts = status.getResolvedDependencies();

            // resolve the rest of the artifacts
            ArtifactsResolver artifactsResolver =
                new DefaultArtifactsResolver( this.resolver, this.getLocal(), this.remoteRepos, stopOnFailure );
            resolvedArtifacts = artifactsResolver.resolve( artifacts, getLog() );

            // calculate the artifacts not resolved.
            unResolvedArtifacts.addAll( artifacts );
            unResolvedArtifacts.removeAll( resolvedArtifacts );
        }

        // return a bean of all 3 sets.
        status.setResolvedDependencies( resolvedArtifacts );
        status.setUnResolvedDependencies( unResolvedArtifacts );

        return status;
    }
View Full Code Here

        // calculate the skipped artifacts
        Set<Artifact> skippedArtifacts = new HashSet<Artifact>();
        skippedArtifacts.addAll( artifacts );
        skippedArtifacts.removeAll( unMarkedArtifacts );

        return new DependencyStatusSets( unMarkedArtifacts, null, skippedArtifacts );
    }
View Full Code Here

     * @see #copyArtifact(Artifact, boolean)
     */
    protected void doExecute()
        throws MojoExecutionException
    {
        DependencyStatusSets dss = getDependencySets( this.failOnMissingClassifierArtifact, addParentPoms );
        Set<Artifact> artifacts = dss.getResolvedDependencies();

        if ( !useRepositoryLayout )
        {
            for ( Artifact artifact : artifacts )
            {
                copyArtifact( artifact, isStripVersion(), this.prependGroupId, this.useBaseVersion,
                              this.stripClassifier );
            }
        }
        else
        {
            try
            {
                ArtifactRepository targetRepository =
                    repositoryFactory.createDeploymentArtifactRepository( "local",
                                                                          outputDirectory.toURL().toExternalForm(),
                                                                          repositoryLayouts.get( "default" ),
                                                                          false /* uniqueVersion */ );
                for ( Artifact artifact : artifacts )
                {
                    installArtifact( artifact, targetRepository );
                }
            }
            catch ( MalformedURLException e )
            {
                throw new MojoExecutionException( "Could not create outputDirectory repository", e );
            }
        }

        Set<Artifact> skippedArtifacts = dss.getSkippedDependencies();
        for ( Artifact artifact : skippedArtifacts )
        {
            getLog().info( artifact.getId() + " already exists in destination." ) ;
        }

View Full Code Here

     */
    protected Set<Artifact> getResolvedDependencies( boolean stopOnFailure )
        throws MojoExecutionException

    {
        DependencyStatusSets status = getDependencySets( stopOnFailure );

        return status.getResolvedDependencies();
    }
View Full Code Here

        {
            throw new MojoExecutionException( e.getMessage(), e );
        }

        // transform artifacts if classifier is set
        DependencyStatusSets status;
        if ( StringUtils.isNotEmpty( classifier ) )
        {
            status = getClassifierTranslatedDependencies( artifacts, stopOnFailure );
        }
        else
View Full Code Here

TOP

Related Classes of org.apache.maven.plugin.dependency.utils.DependencyStatusSets

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.