Examples of ArtifactFactory


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

        if ( version == null || version.trim().length() == 0 )
        {
          version = JSW_DEFAULT_VERSION;
        }

        ArtifactFactory factory = request.getArtifactFactory();
        Artifact artifact = factory.createArtifact( JSW_GROUPID, JSW_ARTIFACTID, version, "",  JSW_TYPE);

        ArtifactResolver resolver = request.getArtifactResolver();
        try
        {
            resolver.resolve( artifact, request.getRemoteRepositories(), request.getLocalRepository() );
View Full Code Here

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

{
   
    public void testExcludedArtifactWithRangeShouldNotCauseNPE()
        throws Exception
    {
        ArtifactFactory factory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
       
        Artifact excluded = factory.createDependencyArtifact( "group", "artifact", VersionRange.createFromVersionSpec( "[1.2.3]" ), "jar", null, Artifact.SCOPE_PROVIDED );
       
        ArtifactFilter filter = new ScopeArtifactFilter( Artifact.SCOPE_RUNTIME );
       
        assertFalse( filter.include( excluded ) );
    }
View Full Code Here

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

        Field createSourcesJar = ShadeMojo.class.getDeclaredField( "createSourcesJar" );
        createSourcesJar.setAccessible( true );
        createSourcesJar.set( mojo, Boolean.TRUE );

        // configure artifactFactory for mojo
        ArtifactFactory artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
        Field artifactFactoryField = ShadeMojo.class.getDeclaredField( "artifactFactory" );
        artifactFactoryField.setAccessible( true );
        artifactFactoryField.set( mojo, artifactFactory );

        // configure artifactResolver (mocked) for mojo
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 ) );

            Map managedDependencies = pom.getMavenProject().getManagedVersionMap();
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

                    }
                }
            }
        }
       
        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

            return;
        }

        ArtifactContext artifactContext = null;
        AssemblyResolver assemblyResolver = null;
        ArtifactFactory artifactFactory = null;
        DataAccessObjectRegistry daoRegistry = null;
        try {
            artifactContext = (ArtifactContext) container.lookup(ArtifactContext.ROLE);
            assemblyResolver = (AssemblyResolver) container.lookup(AssemblyResolver.ROLE);
            artifactFactory = (ArtifactFactory) container.lookup(ArtifactFactory.ROLE);
View Full Code Here

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

        File pom = fileManager.createFile( tempDir, "pom.xml", pomContent );
        File jar = fileManager.createFile( tempDir, "artifact-test.jar", jarContent );

        MavenProject pluginProject = new MavenProject();

        ArtifactFactory artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );

        Artifact pluginArtifact = artifactFactory.createArtifact( "group", "artifact", "test", null, "jar" );
        pluginArtifact.setFile( jar );
        pluginArtifact.addMetadata( new ProjectArtifactMetadata( pluginArtifact, pom ) );

        pluginProject.setArtifact( pluginArtifact );
        pluginProject.setFile( pom );
View Full Code Here

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

        File pom = fileManager.createFile( tempDir, "pom.xml", pomContent );
        File jar = fileManager.createFile( tempDir, "artifact-test.jar", jarContent );

        MavenProject pluginProject = new MavenProject();

        ArtifactFactory artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );

        Artifact pluginArtifact = artifactFactory.createArtifact( "group", "artifact", "test", null, "jar" );
        pluginArtifact.setFile( jar );
        pluginArtifact.addMetadata( new ProjectArtifactMetadata( pluginArtifact, pom ) );

        pluginProject.setArtifact( pluginArtifact );
        pluginProject.setFile( pom );
View Full Code Here

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

        model.addDependency( dep );

        MavenProject project = new MavenProject( model );

        ArtifactFactory factory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );

        project.setArtifacts( project.createArtifacts( factory, null, null ) );

        String key = ArtifactUtils.versionlessKey( groupId, artifactId );
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.