Package org.apache.maven.artifact.handler

Examples of org.apache.maven.artifact.handler.ArtifactHandler


    private Map<String, ArtifactHandler> unmanagedHandlers = new ConcurrentHashMap<String, ArtifactHandler>();

    public ArtifactHandler getArtifactHandler( String type )
    {
        ArtifactHandler handler = unmanagedHandlers.get( type );

        if ( handler == null )
        {
            handler = artifactHandlers.get( type );
View Full Code Here


        if ( artifact == null )
        {
            return null;
        }

        ArtifactHandler handler = newHandler( artifact );

        /*
         * NOTE: From Artifact.hasClassifier(), an empty string and a null both denote "no classifier". However, some
         * plugins only check for null, so be sure to nullify an empty classifier.
         */
 
View Full Code Here

            this.handlerManager = handlerManager;
        }

        public ArtifactType get( String stereotypeId )
        {
            ArtifactHandler handler = handlerManager.getArtifactHandler( stereotypeId );
            return newArtifactType( stereotypeId, handler );
        }
View Full Code Here

        {
            // system scopes come through unchanged...
            desiredScope = Artifact.SCOPE_SYSTEM;
        }

        ArtifactHandler handler = artifactHandlerManager.getArtifactHandler( type );

        return new DefaultArtifact( groupId, artifactId, versionRange, desiredScope, type, classifier, handler,
                                    optional );
    }
View Full Code Here

     * @return the artifact
     */
    protected Artifact createArtifact( String groupId, String artifactId, String type, String version )
    {
        VersionRange versionRange = VersionRange.createFromVersion( version );
        ArtifactHandler handler = new DefaultArtifactHandler();

        return new DefaultArtifact( groupId, artifactId, versionRange, null, type, null, handler );
    }
View Full Code Here

        if ( artifact == null )
        {
            return null;
        }

        ArtifactHandler handler = newHandler( artifact );

        /*
         * NOTE: From Artifact.hasClassifier(), an empty string and a null both denote "no classifier". However, some
         * plugins only check for null, so be sure to nullify an empty classifier.
         */
 
View Full Code Here

            this.handlerManager = handlerManager;
        }

        public ArtifactType get( String stereotypeId )
        {
            ArtifactHandler handler = handlerManager.getArtifactHandler( stereotypeId );
            return newArtifactType( stereotypeId, handler );
        }
View Full Code Here

        artifactResolverField.setAccessible( true );
        artifactResolverField.set( mojo, mockArtifactResolver );

        // create and configure MavenProject
        MavenProject project = new MavenProject();
        ArtifactHandler artifactHandler = (ArtifactHandler) lookup( ArtifactHandler.ROLE );
        Artifact artifact = new DefaultArtifact( "org.apache.myfaces.core", "myfaces-impl",
                                                 VersionRange.createFromVersion( "2.0.1-SNAPSHOT" ), "compile", "jar",
                                                 null, artifactHandler );
        mockArtifactResolver.resolve( artifact, null, null ); // setFile and setResolved
        project.setArtifact( artifact );
View Full Code Here

            logger.finest( "NPANDAY-190-000: Converting Project: Artifact ID = " + project.getArtifactId() +
                ", Dependency Count =" + project.getProjectDependencies().size() );
            Artifact artifact = ProjectFactory.createArtifactFrom( project, artifactFactory, mavenRepository );
            Model model = ProjectFactory.createModelFrom( project );

            ArtifactHandler handler = new DefaultArtifactHandler(
                ArtifactType.getArtifactTypeForPackagingName( artifact.getType() ).getExtension() );
            artifact.setArtifactHandler( handler );

            ArtifactRepositoryLayout layout = new DefaultRepositoryLayout();
            if ( !project.getArtifactType().equals( "pom" ) )
            {
                if ( artifact.getFile().exists() )
                {
                    FileUtils.copyFile( artifact.getFile(), new File( mavenRepository, layout.pathOf( artifact ) ) );
                }
                else
                {
                    logger.warning( "NPANDAY-190-001: Could not find file: " + artifact.getFile().getAbsolutePath() );
                    continue;
                }
            }

            if ( !artifact.getType().equals( "exe.config" ) )//This is attached
            {
                ArtifactHandler pomhandler = new DefaultArtifactHandler( "pom" );
                artifact.setArtifactHandler( pomhandler );

                File pomFile = new File( mavenRepository, pathOfPom( artifact ) );
                pomFile.getParentFile().mkdirs();
                FileWriter fileWriter = new FileWriter( pomFile );
View Full Code Here

        logger.finest( "NPANDAY-190-002: Converting Project: Artifact ID = " + project.getArtifactId() +
            ", Dependency Count =" + project.getProjectDependencies().size() );
        Model model = ProjectFactory.createModelFrom( project );

        ArtifactHandler handler = new DefaultArtifactHandler(
            ArtifactType.getArtifactTypeForPackagingName( artifact.getType() ).getExtension() );
        artifact.setArtifactHandler( handler );

        ArtifactRepositoryLayout layout = new DefaultRepositoryLayout();
        if ( !project.getArtifactType().equals( "pom" ) )
        {
            if ( artifact.getFile().exists() )
            {
                FileUtils.copyFile( artifact.getFile(), new File( mavenRepository, layout.pathOf( artifact ) ) );
            }
            else
            {
                logger.warning( "NPANDAY-190-003: Could not find file: " + artifact.getFile().getAbsolutePath() );
                return;
            }
        }

        if ( applicationConfig != null )
        {
            File destPath = applicationConfig.getConfigBuildPath();
            if ( destPath.exists() )
            {
                FileUtils.copyFile( destPath, applicationConfig.getRepositoryPath( mavenRepository ) );
            }
        }

        if ( !artifact.getType().equals( "exe.config" ) )//This is attached
        {
            ArtifactHandler pomhandler = new DefaultArtifactHandler( "pom" );
            artifact.setArtifactHandler( pomhandler );

            File pomFile = new File( mavenRepository, pathOfPom( artifact ) );
            FileWriter fileWriter = new FileWriter( pomFile );
            new MavenXpp3Writer().write( fileWriter, model );
View Full Code Here

TOP

Related Classes of org.apache.maven.artifact.handler.ArtifactHandler

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.