Package org.apache.maven.project

Examples of org.apache.maven.project.Dependency


     * @param element
     */
    private Dependency parseDependency(String tagName, Element element, boolean strict, String encoding)
        throws IOException, DocumentException
    {
        Dependency dependency = new Dependency();
        dependency.setModelEncoding( encoding );
        java.util.Set parsed = new java.util.HashSet();
        for ( Iterator i = element.nodeIterator(); i.hasNext(); )
        {
            Node node = (Node) i.next();
            if ( node.getNodeType() != Node.ELEMENT_NODE )
            {
            }
            else
            {
                Element childElement = (Element) node;
                if ( childElement.getName().equals( "id" )  )
                {
                    if ( parsed.contains( "id" ) )
                    {
                        throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
                    }
                    parsed.add( "id" );
                    dependency.setId( getTrimmedValue( childElement.getText() ) );
                }
                else if ( childElement.getName().equals( "groupId" )  )
                {
                    if ( parsed.contains( "groupId" ) )
                    {
                        throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
                    }
                    parsed.add( "groupId" );
                    dependency.setGroupId( getTrimmedValue( childElement.getText() ) );
                }
                else if ( childElement.getName().equals( "artifactId" )  )
                {
                    if ( parsed.contains( "artifactId" ) )
                    {
                        throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
                    }
                    parsed.add( "artifactId" );
                    dependency.setArtifactId( getTrimmedValue( childElement.getText() ) );
                }
                else if ( childElement.getName().equals( "version" )  )
                {
                    if ( parsed.contains( "version" ) )
                    {
                        throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
                    }
                    parsed.add( "version" );
                    dependency.setVersion( getTrimmedValue( childElement.getText() ) );
                }
                else if ( childElement.getName().equals( "url" )  )
                {
                    if ( parsed.contains( "url" ) )
                    {
                        throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
                    }
                    parsed.add( "url" );
                    dependency.setUrl( getTrimmedValue( childElement.getText() ) );
                }
                else if ( childElement.getName().equals( "jar" )  )
                {
                    if ( parsed.contains( "jar" ) )
                    {
                        throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
                    }
                    parsed.add( "jar" );
                    dependency.setJar( getTrimmedValue( childElement.getText() ) );
                }
                else if ( childElement.getName().equals( "type" )  )
                {
                    if ( parsed.contains( "type" ) )
                    {
                        throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
                    }
                    parsed.add( "type" );
                    dependency.setType( getTrimmedValue( childElement.getText() ) );
                }
                else if ( childElement.getName().equals( "properties" )  )
                {
                    if ( parsed.contains( "properties" ) )
                    {
                        throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
                    }
                    parsed.add( "properties" );
                    for ( Iterator j = childElement.nodeIterator(); j.hasNext(); )
                    {
                        Node n = (Node) j.next();
                        if ( n.getNodeType() != Node.ELEMENT_NODE )
                        {
                        }
                        else
                        {
                            Element listElement = (Element) n;
                            String key = listElement.getName();
                            String value = listElement.getText()
                            .trim()
                            ;
                            dependency.addProperty( key, value );
                        }
                    }
                }
                else
                {
View Full Code Here

TOP

Related Classes of org.apache.maven.project.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.