Examples of Dependency


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

            install( reader, pom, jar );
        }

        for ( Iterator i = reader.getAllDependencies().iterator(); i.hasNext(); )
        {
            Dependency dep = (Dependency) i.next();

            FileUtils.copyFileToDirectory( resolver.getArtifactFile( dep ), jar.getParentFile() );
        }

        stats( fullStart, new Date() );
View Full Code Here

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

        String type = model.getPackaging();

        Repository localRepository = resolver.getLocalRepository();
        File file = localRepository.getArtifactFile(
            new Dependency( groupId, artifactId, version, type, Collections.EMPTY_LIST ) );

        System.out.println( "Installing: " + file );

        FileUtils.copyFile( jar, file );
View Full Code Here

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

        System.out.println( "Analysing dependencies ..." );

        for ( Iterator i = model.getAllDependencies().iterator(); i.hasNext(); )
        {
            Dependency dep = (Dependency) i.next();

            dep.getRepositories().addAll( model.getRepositories() );

            if ( modelFileCache.containsKey( dep.getId() ) )
            {
                buildProject( resolver.getArtifactFile( dep.getPomDependency() ).getParentFile(), false );
            }
        }

        resolver.downloadDependencies( model.getAllDependencies() );

        System.out.println();
        System.out.println();
        System.out.println( "Building project in " + basedir );

        line();

        // clean
        System.out.println( "Cleaning " + buildDirFile + "..." );
        FileUtils.forceDelete( buildDirFile );

        // ----------------------------------------------------------------------
        // Generate sources - modello
        // ----------------------------------------------------------------------

        File generatedSourcesDirectory = null;
        if ( model.getPlugins().containsKey( MODELLO_PLUGIN_ID ) )
        {
            Plugin plugin = (Plugin) model.getPlugins().get( MODELLO_PLUGIN_ID );

            File modelFile = new File( basedir, (String) plugin.getConfiguration().get( "model" ) );

            System.out.println( "Model exists!" );

            String modelVersion = (String) plugin.getConfiguration().get( "version" );
            if ( modelVersion == null || modelVersion.trim().length() < 1 )
            {
                System.out.println( "No model version configured. Using \'1.0.0\'..." );
                modelVersion = "1.0.0";
            }

            generatedSourcesDirectory = new File( basedir, "target/generated-sources/modello" );

            if ( !generatedSourcesDirectory.exists() )
            {
                generatedSourcesDirectory.mkdirs();
            }

            Dependency dependency = plugin.asDependencyPom();
            resolver.downloadDependencies( Collections.singletonList( dependency ) );
            File artifactFile = resolver.getArtifactFile( dependency );
            Model pluginReader = readModel( artifactFile, true );

            List dependencies = new ArrayList();
            for ( Iterator i = pluginReader.getAllDependencies().iterator(); i.hasNext(); )
            {
                Dependency d = (Dependency) i.next();
                if ( !d.getGroupId().equals( "org.apache.maven" ) )
                {
                    dependencies.add( d );
                }
            }
View Full Code Here

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

    {
        List classpath = new ArrayList( dependencies.size() + 1 );

        for ( Iterator i = dependencies.iterator(); i.hasNext(); )
        {
            Dependency d = (Dependency) i.next();

            String element = resolver.getArtifactFile( d ).getAbsolutePath();

            if ( Dependency.SCOPE_COMPILE.equals( scope ) )
            {
                if ( d.getScope().equals( Dependency.SCOPE_COMPILE ) )
                {
                    classpath.add( element );
                }
            }
            else if ( Dependency.SCOPE_RUNTIME.equals( scope ) )
            {
                if ( d.getScope().equals( Dependency.SCOPE_COMPILE ) ||
                    d.getScope().equals( Dependency.SCOPE_RUNTIME ) )
                {
                    classpath.add( element );
                }
            }
            else if ( Dependency.SCOPE_TEST.equals( scope ) )
View Full Code Here

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

    public void downloadDependencies( Collection dependencies )
        throws DownloadFailedException
    {
        for ( Iterator j = dependencies.iterator(); j.hasNext(); )
        {
            Dependency dep = (Dependency) j.next();

            if ( isAlreadyBuilt( dep ) )
            {
                continue;
            }

            String dependencyConflictId = dep.getDependencyConflictId();
            if ( !downloadedArtifacts.containsKey( dependencyConflictId ) )
            {
                File destinationFile = getLocalRepository().getArtifactFile( dep );
                // The directory structure for this project may
                // not exists so create it if missing.
                File directory = destinationFile.getParentFile();

                if ( !directory.exists() )
                {
                    directory.mkdirs();
                }

                if ( !getRemoteArtifact( dep, destinationFile ) && !destinationFile.exists() )
                {
                    throw new DownloadFailedException( dep );
                }

                downloadedArtifacts.put( dependencyConflictId, dep );
            }
            else
            {
                Dependency d = (Dependency) downloadedArtifacts.get( dependencyConflictId );
                dep.setResolvedVersion( d.getResolvedVersion() );
            }
        }
    }
View Full Code Here

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

            cl = new IsolatedClassLoader( parent );
        }

        for ( Iterator i = dependencies.iterator(); i.hasNext(); )
        {
            Dependency dependency = (Dependency) i.next();

            File f = resolver.getArtifactFile( dependency );
            if ( !f.exists() )
            {
                String msg =
View Full Code Here

Examples of org.apache.maven.model.Dependency

        return createMavenDependency(dependency, dependency.getName(), null, scope, null, configurations);
    }

    private Dependency createMavenDependency(ModuleDependency dependency, String name, String type, String scope, String classifier,
            Set<Configuration> configurations) {
        Dependency mavenDependency =  new Dependency();
        mavenDependency.setGroupId(dependency.getGroup());
        mavenDependency.setArtifactId(name);
        mavenDependency.setVersion(dependency.getVersion());
        mavenDependency.setType(type);
        mavenDependency.setScope(scope);
        mavenDependency.setOptional(false);
        mavenDependency.setClassifier(classifier);
        mavenDependency.setExclusions(getExclusions(dependency, configurations));
        return mavenDependency;
    }
View Full Code Here

Examples of org.apache.maven.model.Dependency

        final List dependencies = this.project.getDependencies();
        if (dependencies != null && !dependencies.isEmpty())
        {
            for (final Iterator iterator = dependencies.iterator(); iterator.hasNext();)
            {
                final Dependency dependency = (Dependency)iterator.next();
                if (Artifact.SCOPE_PROVIDED.equals(dependency.getScope()))
                {
                    final String file = this.getDependencyFile(dependency);
                    if (file != null)
                    {
                        classpathElements.add(file);
View Full Code Here

Examples of org.apache.maven.model.Dependency

        List<DependencyManagement> importMngts = null;

        for ( Iterator<Dependency> it = depMngt.getDependencies().iterator(); it.hasNext(); )
        {
            Dependency dependency = it.next();

            if ( !"pom".equals( dependency.getType() ) || !"import".equals( dependency.getScope() ) )
            {
                continue;
            }

            it.remove();

            String groupId = dependency.getGroupId();
            String artifactId = dependency.getArtifactId();
            String version = dependency.getVersion();

            String imported = groupId + ':' + artifactId + ':' + version;

            if ( importIds.contains( imported ) )
            {
                String message = "The dependencies of type=pom and with scope=import form a cycle: ";
                for ( String modelId : importIds )
                {
                    message += modelId + " -> ";
                }
                message += imported;
                problems.add( Severity.ERROR, message, null, null );

                continue;
            }

            DependencyManagement importMngt =
                getCache( request.getModelCache(), groupId, artifactId, version, ModelCacheTag.IMPORT );

            if ( importMngt == null )
            {
                if ( modelResolver == null )
                {
                    throw new IllegalArgumentException( "no model resolver provided, cannot resolve import POM "
                        + ModelProblemUtils.toId( groupId, artifactId, version ) + " for POM "
                        + ModelProblemUtils.toSourceHint( model ) );
                }

                ModelSource importSource;
                try
                {
                    importSource = modelResolver.resolveModel( groupId, artifactId, version );
                }
                catch ( UnresolvableModelException e )
                {
                    StringBuilder buffer = new StringBuilder( 256 );
                    buffer.append( "Non-resolvable import POM" );
                    if ( !containsCoordinates( e.getMessage(), groupId, artifactId, version ) )
                    {
                        buffer.append( " " ).append( ModelProblemUtils.toId( groupId, artifactId, version ) );
                    }
                    buffer.append( ": " ).append( e.getMessage() );

                    problems.add( Severity.ERROR, buffer.toString(), dependency.getLocation( "" ), e );
                    continue;
                }

                if ( importRequest == null )
                {
View Full Code Here

Examples of org.apache.maven.model.Dependency

        return createDependency( project.getGroupId(), project.getArtifactId(), project.getVersion() );
    }

    private Dependency createDependency( String groupId, String artifactId, String version )
    {
        Dependency depdendency = new Dependency();
        depdendency.setGroupId( groupId );
        depdendency.setArtifactId( artifactId );
        depdendency.setVersion( version );
        return depdendency;
    }
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.