Examples of ArtifactFactory


Examples of org.apache.maven.artifact.factory.ArtifactFactory

    }

    protected Artifact createArtifact( String groupId, String artifactId, String version, String type )
        throws Exception
    {
        ArtifactFactory artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );

        return artifactFactory.createBuildArtifact( groupId, artifactId, version, type );
    }
View Full Code Here

Examples of org.apache.maven.artifact.factory.ArtifactFactory

                    }
                }
            }
        }
       
        ArtifactFactory artifactFactory = (ArtifactFactory) container.lookup( ArtifactFactory.ROLE );
        Artifact artifact =
            artifactFactory.createArtifact( groupId, artifactId, version, Artifact.SCOPE_RUNTIME, "jar" );
        Artifact dummyArtifact = artifactFactory.createProjectArtifact( "dummy", "dummy", "1.0" );

        if ( artifact.isSnapshot() )
        {
            remoteRepositories.add( factory.createArtifactRepository( "apache.snapshots",
                                                                      "http://people.apache.org/repo/m2-snapshot-repository",
View Full Code Here

Examples of org.apache.maven.artifact.factory.ArtifactFactory

    @Override
    public void deploy(MavenEmbedder embedder, ArtifactRepository deploymentRepository, TaskListener listener) throws MavenEmbedderException, IOException, ComponentLookupException, ArtifactDeploymentException {
        ArtifactHandlerManager handlerManager = embedder.lookup(ArtifactHandlerManager.class);

        ArtifactFactory artifactFactory = embedder.lookup(ArtifactFactory.class);
        PrintStream logger = listener.getLogger();
        boolean maven3orLater = MavenUtil.maven3orLater(parent.getModuleSetBuild().getMavenVersionUsed());
        boolean uniqueVersion = true;
        if (!deploymentRepository.isUniqueVersion()) {
            if (maven3orLater) {
View Full Code Here

Examples of org.apache.maven.artifact.factory.ArtifactFactory

     * Installs the artifact to the local Maven repository.
     */
    public void install(MavenEmbedder embedder) throws MavenEmbedderException, IOException, ComponentLookupException, ArtifactInstallationException {
        ArtifactHandlerManager handlerManager = embedder.lookup(ArtifactHandlerManager.class);
        ArtifactInstaller installer = embedder.lookup(ArtifactInstaller.class);
        ArtifactFactory factory = embedder.lookup(ArtifactFactory.class);

        Artifact main = mainArtifact.toArtifact(handlerManager,factory,parent);
        if(!isPOM())
            main.addMetadata(new ProjectArtifactMetadata(main,pomArtifact.getFile(parent)));
        installer.install(mainArtifact.getFile(parent),main,embedder.getLocalRepository());
View Full Code Here

Examples of org.apache.maven.artifact.factory.ArtifactFactory

            Parent parent = model.getParent();
            String groupId = parent.getGroupId();
            String artifactId = parent.getArtifactId();
            String version = parent.getVersion();

            ArtifactFactory factory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
            Artifact parentArtifact = factory.createParentArtifact( groupId, artifactId, version );

            try
            {
                MavenMetadataSource metadataSource = (MavenMetadataSource) lookup( ArtifactMetadataSource.ROLE );
                ArtifactResolver resolver = (ArtifactResolver) lookup( ArtifactResolver.ROLE );
View Full Code Here

Examples of org.apache.maven.artifact.factory.ArtifactFactory

        return pom;
    }
   
    protected Artifact createDummyArtifact()
    {
        ArtifactFactory factory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
        // TODO: maybe not strictly correct, while we should enforce that packaging has a type handler of the same id, we don't
        return factory.createBuildArtifact( "unspecified", "unspecified", "0.0", "jar" );
    }
View Full Code Here

Examples of org.apache.maven.artifact.factory.ArtifactFactory

            throw new BuildException( "Unable to get extension '" +
                ArtifactUtils.versionlessKey( groupId, artifactId ) + "' because version '" + version +
                " is invalid: " + e.getMessage(), e );
        }

        ArtifactFactory factory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
        Artifact providerArtifact = factory.createExtensionArtifact( groupId, artifactId, versionRange );

        log( "Installing provider: " + providerArtifact );

        ArtifactResolutionResult result;
        try
View Full Code Here

Examples of org.apache.maven.artifact.factory.ArtifactFactory

       
        ArtifactRepository localRepo = createLocalArtifactRepository();
        log( "Using local repository: " + localRepo.getBasedir(), Project.MSG_VERBOSE );

        ArtifactResolver resolver = (ArtifactResolver) lookup( ArtifactResolver.ROLE );
        ArtifactFactory artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
        MavenMetadataSource metadataSource = (MavenMetadataSource) lookup( ArtifactMetadataSource.ROLE );

        List dependencies = this.dependencies;

        Pom pom = buildPom( localRepo );
        if ( pom != null )
        {
            if ( !dependencies.isEmpty() )
            {
                throw new BuildException( "You cannot specify both dependencies and a pom in the dependencies task" );
            }

            dependencies = pom.getDependencies();
        }
        else
        {
            // we have to have some sort of Pom object in order to satisfy the requirements for building the
            // originating Artifact below...
            pom = createDummyPom( localRepo );
        }

        if ( dependencies.isEmpty() )
        {
            log( "There were no dependencies specified", Project.MSG_WARN );
        }

        log( "Resolving dependencies...", Project.MSG_VERBOSE );

        ArtifactResolutionResult result;
        Set artifacts;

        List remoteArtifactRepositories = createRemoteArtifactRepositories( pom.getRepositories() );

        try
        {
            artifacts = MavenMetadataSource.createArtifacts( artifactFactory, dependencies, null, null, null );

            Artifact pomArtifact = artifactFactory.createBuildArtifact( pom.getGroupId(), pom.getArtifactId(), pom
                .getVersion(), pom.getPackaging() );

            List listeners = Collections.singletonList( new AntResolutionListener( getProject(), verbose ) );

            // TODO: managed dependencies
View Full Code Here

Examples of org.apache.maven.artifact.factory.ArtifactFactory

    }

    protected Artifact createArtifact( String groupId, String artifactId, String version )
        throws Exception
    {
        ArtifactFactory artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );

        // TODO: used to be SCOPE_COMPILE, check
        return artifactFactory.createBuildArtifact( groupId, artifactId, version, "jar" );
    }
View Full Code Here

Examples of org.apache.maven.artifact.factory.ArtifactFactory

        ProjectSorter sorter = new ProjectSorter( reactorProjects );

        reactorProjects = sorter.getSortedProjects();

        ArtifactFactory artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
        ArtifactCollector artifactCollector = (ArtifactCollector) lookup( ArtifactCollector.class.getName() );
        ArtifactMetadataSource artifactMetadataSource = (ArtifactMetadataSource) lookup( ArtifactMetadataSource.ROLE );

        // pass back over and resolve dependencies - can't be done earlier as the order may not be correct
        for ( Iterator i = reactorProjects.iterator(); i.hasNext(); )
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.