Package org.apache.maven.project

Examples of org.apache.maven.project.Dependency


        if (classLoader == null) {
            String repo = context.getMavenRepoLocal();
            List urls = new ArrayList();
            for (Iterator iterator = pluginArtifacts.iterator(); iterator.hasNext();) {
                Artifact artifact = (Artifact) iterator.next();
                Dependency dependency = artifact.getDependency();
                if ("true".equals(dependency.getProperty(PACKAGING_CLASSPATH_PROPERTY))) {
                    String urlString = artifact.getUrlPath();
                    URL url = new File(repo + urlString).toURL();
                    urls.add(url);
                }
            }

            boolean found = false;
            for (Iterator iterator = artifacts.iterator(); iterator.hasNext();) {
                Artifact artifact = (Artifact) iterator.next();
                Dependency dependency = artifact.getDependency();
                if ("geronimo".equals(dependency.getGroupId())
                && "geronimo-packaging-plugin".equals(dependency.getArtifactId())
                && "plugin".equals(dependency.getType())) {
                    String urlString = artifact.getUrlPath();
                    URL url = new File(repo + urlString).toURL();
                    urls.add(url);
                    found = true;
                }
View Full Code Here


    private LinkedHashSet toDependencies() {
        LinkedHashSet dependencies = new LinkedHashSet();
        for (Iterator iterator = artifacts.iterator(); iterator.hasNext();) {
            Artifact artifact = (Artifact) iterator.next();
            Dependency dependency = artifact.getDependency();
            org.apache.geronimo.kernel.repository.Dependency geronimoDependency = toGeronimoDependency(dependency);
            if (geronimoDependency != null) {
                dependencies.add(geronimoDependency);
            }
        }
View Full Code Here

        return p;
    }

    private static Dependency createDependency( String id )
    {
        Dependency d = new Dependency();
        d.setId( id );
        return d;
    }
View Full Code Here

        StringTokenizer depToks = new StringTokenizer( dependencies, ",", false );
        Project p = createProject( id );
        while ( depToks.hasMoreTokens() )
        {
            String token = depToks.nextToken();
            Dependency d = createDependency( token );
            p.addDependency( d );
        }
        return p;
    }
View Full Code Here

                Goal projectGoal = getExistingGoal( project );

                Iterator depIter = project.getDependencies().iterator();
                while ( depIter.hasNext() )
                {
                    Dependency dep = (Dependency) depIter.next();
                    Project depProject = new Project();
                    depProject.setId( dep.getId() );

                    Goal depGoal = getOrCreateGoal( depProject, false );
                    projectGoal.addPrecursor( depGoal );
                }
            }
View Full Code Here

        List projectArtifacts = new ArrayList();
        boolean mavenJarOverride = project.getContext().getMavenJarOverride().booleanValue();

        for ( Iterator i = project.getDependencies().iterator(); i.hasNext(); )
        {
            Dependency d = (Dependency) i.next();
            String mavenJarProperty = project.getContext()
                .getMavenJarOverride( Project.standardToLegacyId( d.getId() ) );
            Artifact artifact = DefaultArtifactFactory.createArtifact( d );

            if ( mavenJarOverride && StringUtils.isNotEmpty( mavenJarProperty ) )
            {
                // The jar override option has been set and we have a property
                // for the this dependency so override the path with the user
                // specified value.
                if ( Character.isDigit( mavenJarProperty.charAt( 0 ) ) || "SNAPSHOT".equals( mavenJarProperty ) )
                {
                    // User is requesting a specific version of a dependency
                    // be used.
                    d.setVersion( mavenJarProperty );
                    artifact.setPath( project.getContext().getMavenRepoLocal() + artifact.generatePath() );
                    artifact.setOverrideType( Artifact.OVERRIDE_VERSION );
                }
                else
                {
View Full Code Here

        StringBuffer classpath = new StringBuffer();

        for ( Iterator i = project.getArtifacts().iterator(); i.hasNext(); )
        {
            Artifact artifact = (Artifact) i.next();
            Dependency d = artifact.getDependency();

            // Only add jar or ejb (MAVEN-512) dependencies to the classpath
            if ( d.isAddedToClasspath() )
            {
                classpath.append( artifact.getPath() ).append( cps );
            }
            project.setDependencyPath( d.getKey(), artifact.getPath() );
        }

        return classpath.toString();
    }
View Full Code Here

        // add the dependencies to the classpath
        for ( Iterator i = project.getArtifacts().iterator(); i.hasNext(); )
        {
            Artifact artifact = (Artifact) i.next();
            Dependency dependency = artifact.getDependency();
            if ( dependency.isPlugin() )
            {
                // TODO: is this the best place to call this?
                installPlugin( artifact.getFile(), project );
            }

            // get correct classloader
            String dependencyClassLoader = dependency.getProperty( "classloader" );

            // add to classloader
            if ( artifact.exists() )
            {
                // Only add compile type dependencies to classloader
                // what about ejbs etc
                if ( dependency.isAddedToClasspath() )
                {
                    if ( dependencyClassLoader != null )
                    {
                        LOGGER.debug( "DEPRECATION: " + dependency.getId() + " in project " + project.getId()
                            + " forces the classloader '" + dependencyClassLoader + "'" );
                        LOGGER.debug( "             This behaviour is deprecated. Please refer to the FAQ" );
                        ForeheadClassLoader loader = Forehead.getInstance().getClassLoader( dependencyClassLoader );
                        if ( loader == null )
                        {
View Full Code Here

        }
        ServiceDocument serviceDocument = ServiceDocument.Factory.newInstance();
        ServiceType serviceType = serviceDocument.addNewService();
        for (Iterator iterator = artifacts.iterator(); iterator.hasNext();) {
            Artifact artifact = (Artifact) iterator.next();
            Dependency dependency = (Dependency) artifact.getDependency();
            if ("true".equals(dependency.getProperty(DEPENDENCY_PROPERTY))) {
                String groupId = dependency.getGroupId();
                String artifactId = dependency.getArtifactId();
                String version = dependency.getVersion();
                String type = dependency.getType();
                org.apache.geronimo.deployment.xbeans.DependencyType dependencyType = serviceType.addNewDependency();
                dependencyType.setGroupId(groupId);
                dependencyType.setArtifactId(artifactId);
                dependencyType.setVersion(version);
                if (type != null && !"jar".equals(type)) {
View Full Code Here

            xmlCursor.toEndToken();
            xmlCursor.toNextToken();
        }
        for (Iterator iterator = artifacts.iterator(); iterator.hasNext();) {
            Artifact artifact = (Artifact) iterator.next();
            Dependency dependency = (Dependency) artifact.getDependency();
            if ("true".equals(dependency.getProperty(artifactProperty))) {
                String groupId = dependency.getGroupId();
                String artifactId = dependency.getArtifactId();
                String version = dependency.getVersion();
                String type = dependency.getType();
                org.apache.geronimo.deployment.xbeans.DependencyType dependencyType = org.apache.geronimo.deployment.xbeans.DependencyType.Factory.newInstance();
                dependencyType.setGroupId(groupId);
                dependencyType.setArtifactId(artifactId);
                dependencyType.setVersion(version);
                if (type != null && !"jar".equals(type)) {
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.