Package org.apache.maven.archiva.model

Examples of org.apache.maven.archiva.model.Dependency


        {
            List merged = ArchivaModelCloner.cloneDependencies( parentDepMgmt );
            Iterator it = merged.iterator();
            while ( it.hasNext() )
            {
                Dependency dep = (Dependency) it.next();
                dep.setFromParent( true );
            }
            return merged;
        }

        List merged = new ArrayList();

        Map mainDepMap = createDependencyMap( mainDepMgmt );
        Map parentDepMap = createDependencyMap( parentDepMgmt );
        Set uniqueKeys = new HashSet();
        uniqueKeys.addAll( mainDepMap.keySet() );
        uniqueKeys.addAll( parentDepMap.keySet() );

        Iterator it = uniqueKeys.iterator();
        while ( it.hasNext() )
        {
            String key = (String) it.next();
            Dependency parentDep = (Dependency) parentDepMap.get( key );
            Dependency mainDep = (Dependency) mainDepMap.get( key );

            if ( parentDep == null )
            {
                // Means there is no parent depMan entry to override main depMan.
                merged.add( mainDep );
View Full Code Here


        if ( CollectionUtils.isNotEmpty( model.getDependencyManagement() ) )
        {
            it = model.getDependencyManagement().iterator();
            while ( it.hasNext() )
            {
                Dependency dependency = (Dependency) it.next();
                fromNode.addDependencyManagement( dependency );
            }
        }

        if ( CollectionUtils.isNotEmpty( model.getDependencies() ) )
        {
            it = model.getDependencies().iterator();
            while ( it.hasNext() )
            {
                Dependency dependency = (Dependency) it.next();

                String scope = dependency.getScope();

                // Test scopes *NOT* from root node can be skipped.
                if ( DependencyScope.TEST.equals( scope ) && !isRootNode )
                {
                    // skip add of test scope
                    continue;
                }

                ArtifactReference artifactRef = new ArtifactReference();
                artifactRef.setGroupId( dependency.getGroupId() );
                artifactRef.setArtifactId( dependency.getArtifactId() );
                artifactRef.setVersion( dependency.getVersion() );
                artifactRef.setClassifier( dependency.getClassifier() );
                artifactRef.setType( dependency.getType() );

                DependencyGraphNode toNode = new DependencyGraphNode( artifactRef );

                if ( CollectionUtils.isNotEmpty( dependency.getExclusions() ) )
                {
                    Iterator itexclusion = dependency.getExclusions().iterator();
                    while ( itexclusion.hasNext() )
                    {
                        Exclusion exclusion = (Exclusion) itexclusion.next();
                        toNode.addExclude( exclusion );
                    }
                }

                if ( dependency.isFromParent() )
                {
                    toNode.setFromParent( true );
                }

                // Add node (to)
                graph.addNode( toNode );

                DependencyGraphEdge edge = new DependencyGraphEdge( fromNode.getArtifact(), toNode.getArtifact() );
                edge.setScope( StringUtils.defaultIfEmpty( dependency.getScope(), DependencyScope.COMPILE ) );

                if ( dependency.isOptional() )
                {
                    edge.setDisabled( true );
                    edge.setDisabledType( DependencyGraph.DISABLED_OPTIONAL );
                    edge.setDisabledReason( "Optional Dependency" );
                }
View Full Code Here

        Map<String, Dependency> ret = new HashMap<String, Dependency>();

        Iterator<Dependency> it = dependencies.iterator();
        while ( it.hasNext() )
        {
            Dependency dep = it.next();
            String key = toVersionlessDependencyKey( dep );
            ret.put( key, dep );
        }

        return ret;
View Full Code Here

            return mainDep;
        }

        if ( mainDep == null )
        {
            Dependency dep = ArchivaModelCloner.clone( parentDep );
            dep.setFromParent( true );
            return dep;
        }

        Dependency merged = new Dependency();

        merged.setFromParent( true );

        // Unmerged.
        merged.setGroupId( mainDep.getGroupId() );
        merged.setArtifactId( mainDep.getArtifactId() );

        // Merged.
        merged.setVersion( merge( mainDep.getVersion(), parentDep.getVersion() ) );
        merged.setClassifier( merge( mainDep.getClassifier(), parentDep.getClassifier() ) );
        merged.setType( merge( mainDep.getType(), parentDep.getType() ) );
        merged.setScope( merge( mainDep.getScope(), parentDep.getScope() ) );
        if ( parentDep.isOptional() )
        {
            merged.setOptional( true );
        }

        merged.setSystemPath( merge( mainDep.getSystemPath(), parentDep.getSystemPath() ) );
        merged.setUrl( merge( mainDep.getUrl(), parentDep.getUrl() ) );
        merged.setExclusions( mergeExclusions( mainDep.getExclusions(), parentDep.getExclusions() ) );

        return merged;
    }
View Full Code Here

        {
            List<Dependency> merged = ArchivaModelCloner.cloneDependencies( parentDependencies );
            Iterator<Dependency> it = merged.iterator();
            while ( it.hasNext() )
            {
                Dependency dep = it.next();
                dep.setFromParent( true );
            }
            return merged;
        }

        List<Dependency> merged = new ArrayList<Dependency>();

        Map<String, Dependency> mainDepMap = createDependencyMap( mainDependencies );
        Map<String, Dependency> parentDepMap = createDependencyMap( parentDependencies );
        Set<String> uniqueKeys = new HashSet<String>();
        uniqueKeys.addAll( mainDepMap.keySet() );
        uniqueKeys.addAll( parentDepMap.keySet() );

        Iterator<String> it = uniqueKeys.iterator();
        while ( it.hasNext() )
        {
            String key = it.next();
            Dependency parentDep = parentDepMap.get( key );
            Dependency mainDep = mainDepMap.get( key );

            if ( parentDep == null )
            {
                // Means there is no parent dep to override main dep.
                merged.add( mainDep );
View Full Code Here

        {
            List<Dependency> merged = ArchivaModelCloner.cloneDependencies( parentDepMgmt );
            Iterator<Dependency> it = merged.iterator();
            while ( it.hasNext() )
            {
                Dependency dep = it.next();
                dep.setFromParent( true );
            }
            return merged;
        }

        List<Dependency> merged = new ArrayList<Dependency>();

        Map<String, Dependency> mainDepMap = createDependencyMap( mainDepMgmt );
        Map<String, Dependency> parentDepMap = createDependencyMap( parentDepMgmt );
        Set<String> uniqueKeys = new HashSet<String>();
        uniqueKeys.addAll( mainDepMap.keySet() );
        uniqueKeys.addAll( parentDepMap.keySet() );

        Iterator<String> it = uniqueKeys.iterator();
        while ( it.hasNext() )
        {
            String key = it.next();
            Dependency parentDep = parentDepMap.get( key );
            Dependency mainDep = mainDepMap.get( key );

            if ( parentDep == null )
            {
                // Means there is no parent depMan entry to override main depMan.
                merged.add( mainDep );
View Full Code Here

        Map<String, Dependency> managedDependencies = createDependencyMap( pom.getDependencyManagement() );
        Iterator<Dependency> it = pom.getDependencies().iterator();
        while ( it.hasNext() )
        {
            Dependency dep = it.next();
            String key = toVersionlessDependencyKey( dep );

            // Do we need to do anything?
            if ( managedDependencies.containsKey( key ) )
            {
                Dependency mgmtDep = (Dependency) managedDependencies.get( key );

                dep.setVersion( mgmtDep.getVersion() );
                dep.setScope( mgmtDep.getScope() );
                dep.setExclusions( ProjectModelMerge.mergeExclusions( dep.getExclusions(), mgmtDep.getExclusions() ) );
            }
        }
    }
View Full Code Here

        Map<String, Dependency> ret = new HashMap<String, Dependency>();

        Iterator<Dependency> it = dependencies.iterator();
        while ( it.hasNext() )
        {
            Dependency dep = it.next();
            String key = toVersionlessDependencyKey( dep );
            ret.put( key, dep );
        }

        return ret;
View Full Code Here

        Iterator<Element> it = depsParent.elementIterator( "dependency" );
        while ( it.hasNext() )
        {
            Element elemDependency = it.next();
            Dependency dependency = new Dependency();

            dependency.setGroupId( elemDependency.elementTextTrim( "groupId" ) );
            dependency.setArtifactId( elemDependency.elementTextTrim( "artifactId" ) );
            dependency.setVersion( elemDependency.elementTextTrim( "version" ) );

            dependency.setType( StringUtils.defaultIfEmpty( elemDependency.elementTextTrim( "type" ), "jar" ) );
            dependency.setUrl( elemDependency.elementTextTrim( "url" ) );
            /* Following are not valid for <pomVersion>3</pomVersion> / Maven 1 pom files.
             *
             * dependency.setClassifier( StringUtils.defaultString( elemDependency.elementTextTrim( "classifier" ) ) );
             * dependency.setScope( StringUtils.defaultIfEmpty( elemDependency.elementTextTrim( "scope" ), "compile" ) );
             * dependency.setOptional( toBoolean( elemDependency.elementTextTrim( "optional" ), false ) );
             */

            dependency.setSystemPath( elemDependency.elementTextTrim( "jar" ) );

            if ( dependencyList.contains( dependency ) )
            {
                // TODO: throw into monitor as "duplicate dependency" issue.
            }
View Full Code Here

    {
        String parts[] = StringUtils.splitPreserveAllTokens( key, ':' );

        assertEquals( "Dependency key [" + key + "] should be 5 parts.", 5, parts.length );

        Dependency dep = new Dependency();

        dep.setGroupId( parts[0] );
        dep.setArtifactId( parts[1] );
        dep.setVersion( parts[2] );
        dep.setClassifier( parts[3] );
        dep.setType( parts[4] );

        return dep;
    }
View Full Code Here

TOP

Related Classes of org.apache.maven.archiva.model.Dependency

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.