Package org.apache.maven.model

Examples of org.apache.maven.model.Relocation


                }
                result.addException( e );
                throw new ArtifactDescriptorException( result );
            }

            Relocation relocation = getRelocation( model );

            if ( relocation != null )
            {
                result.addRelocation( artifact );
                artifact =
                    new RelocatedArtifact( artifact, relocation.getGroupId(), relocation.getArtifactId(),
                                           relocation.getVersion() );
                result.setArtifact( artifact );
            }
            else
            {
                return model;
View Full Code Here


        return props;
    }

    private Relocation getRelocation( Model model )
    {
        Relocation relocation = null;
        DistributionManagement distMngt = model.getDistributionManagement();
        if ( distMngt != null )
        {
            relocation = distMngt.getRelocation();
        }
View Full Code Here

        {
            getLog()
                .info( "Processed " + modelsProcessed + " models (" + seenModels.size() + " unique) ..." );
        }

        Relocation relocation = null;

        if ( seenModels.contains( projectKey ) )
        {
            return;
        }

        seenModels.add( projectKey );

        out.println( "      model = toModel( \"" + projectKey + "\" );" );

        if ( model.getParent() != null )
        {
            String parentKey = toKey( model.getParent() );
            out.println( "      model.setParentProject( toParent( \"" + parentKey + "\" ) );" );
        }

        if ( isNotEmpty( model.getDependencies() ) )
        {
            Iterator it = model.getDependencies().iterator();
            while ( it.hasNext() )
            {
                Dependency dep = applyDepMan( (Dependency) it.next(), model );

                writeAddDependency( "addDependency", dep );
            }
        }

        if ( ( model.getDependencyManagement() != null )
            && isNotEmpty( model.getDependencyManagement().getDependencies() ) )
        {
            Iterator it = model.getDependencyManagement().getDependencies().iterator();
            while ( it.hasNext() )
            {
                Dependency dep = (Dependency) it.next();

                writeAddDependency( "addDependencyManagement", dep );
            }
        }

        if ( isNotEmpty( model.getProperties() ) )
        {
            Iterator it = new EnumerationIterator( model.getProperties().keys() );
            while ( it.hasNext() )
            {
                String key = (String) it.next();
                String value = model.getProperties().getProperty( key );
                out.println( "      model.addProperty( \"" + key + "\", \"" + value + "\" );" );
            }
        }

        if ( model.getDistributionManagement() != null )
        {
            DistributionManagement distMgmt = model.getDistributionManagement();

            if ( distMgmt.getRelocation() != null )
            {
                relocation = distMgmt.getRelocation();

                out.println( "      model.setRelocation( new VersionedReference() );" );
                if ( StringUtils.isNotEmpty( relocation.getGroupId() ) )
                {
                    out.println( "      model.getRelocation().setGroupId( \"" + relocation.getGroupId() + "\" );" );
                }
                if ( StringUtils.isNotEmpty( relocation.getArtifactId() ) )
                {
                    out
                        .println( "      model.getRelocation().setArtifactId( \"" + relocation.getArtifactId()
                            + "\" );" );
                }
                if ( StringUtils.isNotEmpty( relocation.getVersion() ) )
                {
                    out.println( "      model.getRelocation().setVersion( \"" + relocation.getVersion() + "\" );" );
                }
            }
        }

        out.println( "      addModel( model );" );
View Full Code Here

        {
            Model model = new MavenXpp3Reader().read( new FileReader( pom ) );
            DistributionManagement dist = model.getDistributionManagement();
            if ( dist != null )
            {
                Relocation relocation = dist.getRelocation();
                if ( relocation != null )
                {
                    // artifact is relocated : update the repositoryPath
                    if ( relocation.getGroupId() != null )
                    {
                        artifact.setGroupId( relocation.getGroupId() );
                    }
                    if ( relocation.getArtifactId() != null )
                    {
                        artifact.setArtifactId( relocation.getArtifactId() );
                    }
                    if ( relocation.getVersion() != null )
                    {
                        artifact.setVersion( relocation.getVersion() );
                    }
                }
            }
        }
        catch ( FileNotFoundException e )
View Full Code Here

        pom.setArtifactId( artifactId );
        pom.setVersion( version );

        DistributionManagement dMngt = new DistributionManagement();

        Relocation relocation = new Relocation();
        relocation.setGroupId( newGroupId );
        relocation.setArtifactId( newArtifactId );
        relocation.setVersion( newVersion );
        if ( message != null && message.length() > 0 )
        {
            relocation.setMessage( message );
        }

        dMngt.setRelocation( relocation );

        pom.setDistributionManagement( dMngt );
View Full Code Here

            }

            DistributionManagement dist = model.getDistributionManagement();
            if ( dist != null )
            {
                Relocation relocation = dist.getRelocation();
                if ( relocation != null )
                {
                    // artifact is relocated : update the repositoryPath
                    if ( relocation.getGroupId() != null )
                    {
                        artifact.setGroupId( relocation.getGroupId() );
                    }
                    if ( relocation.getArtifactId() != null )
                    {
                        artifact.setArtifactId( relocation.getArtifactId() );
                    }
                    if ( relocation.getVersion() != null )
                    {
                        artifact.setVersion( relocation.getVersion() );
                    }
                }
            }
        }
        catch ( FileNotFoundException e )
View Full Code Here

        {
            Model model = new MavenXpp3Reader().read( new FileReader( pom ) );
            DistributionManagement dist = model.getDistributionManagement();
            if ( dist != null )
            {
                Relocation relocation = dist.getRelocation();
                if ( relocation != null )
                {
                    // artifact is relocated : update the repositoryPath
                    if ( relocation.getGroupId() != null )
                    {
                        artifact.setGroupId( relocation.getGroupId() );
                    }
                    if ( relocation.getArtifactId() != null )
                    {
                        artifact.setArtifactId( relocation.getArtifactId() );
                    }
                    if ( relocation.getVersion() != null )
                    {
                        artifact.setVersion( relocation.getVersion() );
                    }
                }
            }
        }
        catch ( FileNotFoundException e )
View Full Code Here

        pom.setArtifactId( artifactId );
        pom.setVersion( version );

        DistributionManagement dMngt = new DistributionManagement();

        Relocation relocation = new Relocation();
        relocation.setGroupId( newGroupId );
        relocation.setArtifactId( newArtifactId );
        relocation.setVersion( newVersion );
        if ( message != null && message.length() > 0 )
        {
            relocation.setMessage( message );
        }

        dMngt.setRelocation( relocation );

        pom.setDistributionManagement( dMngt );
View Full Code Here

        pom.setArtifactId( artifactId );
        pom.setVersion( version );

        DistributionManagement dMngt = new DistributionManagement();

        Relocation relocation = new Relocation();
        relocation.setGroupId( newGroupId );
        relocation.setArtifactId( newArtifactId );
        relocation.setVersion( newVersion );
        if ( message != null && message.length() > 0 )
        {
            relocation.setMessage( message );
        }

        dMngt.setRelocation( relocation );

        pom.setDistributionManagement( dMngt );
View Full Code Here

            }

            DistributionManagement dist = model.getDistributionManagement();
            if ( dist != null )
            {
                Relocation relocation = dist.getRelocation();
                if ( relocation != null )
                {
                    // artifact is relocated : update the repositoryPath
                    if ( relocation.getGroupId() != null )
                    {
                        artifact.setGroupId( relocation.getGroupId() );
                    }
                    if ( relocation.getArtifactId() != null )
                    {
                        artifact.setArtifactId( relocation.getArtifactId() );
                    }
                    if ( relocation.getVersion() != null )
                    {
                        artifact.setVersion( relocation.getVersion() );
                    }
                }
            }
        }
        catch ( FileNotFoundException e )
View Full Code Here

TOP

Related Classes of org.apache.maven.model.Relocation

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.