Package org.apache.maven.artifact.handler

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


     * @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


    }

    public static ArtifactHandler newHandler( Artifact artifact )
    {
        String type = artifact.getProperty( ArtifactProperties.TYPE, artifact.getExtension() );
        DefaultArtifactHandler handler = new DefaultArtifactHandler( type );
        handler.setExtension( artifact.getExtension() );
        handler.setLanguage( artifact.getProperty( ArtifactProperties.LANGUAGE, null ) );
        handler.setAddedToClasspath( Boolean.parseBoolean( artifact.getProperty( ArtifactProperties.CONSTITUTES_BUILD_PATH,
                                                                                 "" ) ) );
        handler.setIncludesDependencies( Boolean.parseBoolean( artifact.getProperty( ArtifactProperties.INCLUDES_DEPENDENCIES,
                                                                                     "" ) ) );
        return handler;
    }
View Full Code Here

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

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

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

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

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

        return new DefaultArtifact( groupId, artifactId, versionRange, desiredScope, type, classifier,
                                    new DefaultArtifactHandler(type), optional );
    }
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

    }

    public ArtifactStub( String groupId, String artifactId, String version, String packaging, String classifier, String scope )
    {
        super( groupId, artifactId, VersionRange.createFromVersion( version ), scope, packaging,
               classifier, new DefaultArtifactHandler( packaging ), false );
    }
View Full Code Here

    public Set getDependencyArtifacts()
    {
        return Collections.singleton(
            new DefaultArtifact( "cactify", "dependency-artifact", VersionRange.createFromVersion( "1.0" ),
                                 Artifact.SCOPE_COMPILE, "jar", null, new DefaultArtifactHandler( "jar" ), false )
            );
    }
View Full Code Here

    public ArtifactStub()
    {
        type = "testtype";
        scope = "testscope";
        classifier = "testclassifier";
        artifactHandler = new DefaultArtifactHandler();
    }
View Full Code Here

TOP

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

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.