Package org.apache.maven.model

Examples of org.apache.maven.model.DistributionManagement


        }

        try
        {
            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 )
                    {
View Full Code Here


            try (Reader reader = Files.newBufferedReader( pom.toPath(), Charset.defaultCharset() ))
            {
                model = MAVEN_XPP_3_READER.read( reader );
            }

            DistributionManagement dist = model.getDistributionManagement();
            if ( dist != null )
            {
                Relocation relocation = dist.getRelocation();
                if ( relocation != null )
                {
                    // artifact is relocated : update the repositoryPath
                    if ( relocation.getGroupId() != null )
                    {
View Full Code Here

    }

    protected void mergeModelBase_DistributionManagement( ModelBase target, ModelBase source, boolean sourceDominant,
                                                          Map<Object, Object> context )
    {
        DistributionManagement src = source.getDistributionManagement();
        if ( src != null )
        {
            DistributionManagement tgt = target.getDistributionManagement();
            if ( tgt == null )
            {
                tgt = new DistributionManagement();
                target.setDistributionManagement( tgt );
            }
            mergeDistributionManagement( tgt, src, sourceDominant, context );
        }
    }
View Full Code Here

                if ( project != null )
                {
                    Relocation relocation = null;

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

                        artifact.setDownloadUrl( distMgmt.getDownloadUrl() );
                        pomArtifact.setDownloadUrl( distMgmt.getDownloadUrl() );
                    }

                    if ( relocation != null )
                    {
                        if ( relocation.getGroupId() != null )
View Full Code Here

    private DistributionManagement translateDistributionManagement( PomKey pomKey,
                                                                    org.apache.maven.model.v3_0_0.Model v3Model )
        throws PomTranslationException
    {
        DistributionManagement distributionManagement = new DistributionManagement();

        Site site = null;

        String siteAddress = v3Model.getSiteAddress();

        String siteDirectory = v3Model.getSiteDirectory();

        if ( StringUtils.isEmpty( siteAddress ) )
        {
            if ( !StringUtils.isEmpty( siteDirectory ) )
            {
                site = new Site();

                site.setId( "default" );

                site.setName( "Default Site" );

                site.setUrl( "file://" + siteDirectory );
            }
        }
        else
        {
            if ( StringUtils.isEmpty( siteDirectory ) )
            {
                throw new PomTranslationException( pomKey.groupId(), pomKey.artifactId(), pomKey.version(),
                                                   "Missing 'siteDirectory': Both siteAddress and siteDirectory must be"
                                                       + " set at the same time." );
            }

            site = new Site();

            site.setId( "default" );

            site.setName( "Default Site" );

            StringBuffer url = new StringBuffer( "scp://" );
            url.append( siteAddress );
            if ( !siteAddress.endsWith( "/" ) && !siteDirectory.startsWith( "/" ) )
            {
                url.append( "/" );
            }
            url.append( siteDirectory );
            site.setUrl( url.toString() );
        }

        distributionManagement.setSite( site );

        String distributionSite = v3Model.getDistributionSite();

        String distributionDirectory = v3Model.getDistributionDirectory();

        DeploymentRepository repository = null;

        if ( StringUtils.isEmpty( distributionSite ) )
        {
            if ( !StringUtils.isEmpty( distributionDirectory ) )
            {
                repository = new DeploymentRepository();

                repository.setId( "default" );

                repository.setName( "Default Repository" );

                repository.setUrl( "file://" + distributionDirectory );
                //                throw new Exception( "Missing 'distributionSite': Both distributionSite and
                // distributionDirectory must be set." );
            }
        }
        else
        {
            if ( StringUtils.isEmpty( distributionDirectory ) )
            {
                throw new PomTranslationException( pomKey.groupId(), pomKey.artifactId(), pomKey.version(),
                                                   "Missing 'distributionDirectory': must be set if 'distributionSite'"
                                                       + "is set." );
            }

            repository = new DeploymentRepository();

            repository.setId( "default" );

            repository.setName( "Default Repository" );

            repository.setUrl( distributionSite + "/" + distributionDirectory );
        }

        distributionManagement.setRepository( repository );

        distributionManagement.setStatus( "converted" );

        if ( site == null && repository == null )
        {
            return null;
        }
View Full Code Here

    private static void setDistMgmntSiteUrl( Model model, String url )
    {
        if ( model.getDistributionManagement() == null )
        {
            model.setDistributionManagement( new DistributionManagement() );
        }

        if ( model.getDistributionManagement().getSite() == null )
        {
            model.getDistributionManagement().setSite( new Site() );
View Full Code Here

                {
                    reader.close();
                }
            }

            DistributionManagement dist = model.getDistributionManagement();
            if ( dist != null )
            {
                Relocation relocation = dist.getRelocation();
                if ( relocation != null )
                {
                    // artifact is relocated : update the repositoryPath
                    if ( relocation.getGroupId() != null )
                    {
View Full Code Here

            {
                return servers;
            }
        };

        final DistributionManagement distributionManagement = new DistributionManagement();
        DeploymentRepository repository = new DeploymentRepository();
        repository.setId( "localhost" );
        repository.setUrl( "http://localhost:8080" );
        distributionManagement.setRepository( repository );
        distributionManagement.setSnapshotRepository( repository );
        projectStub = new MavenProjectStub()
        {
            @Override
            public DistributionManagement getDistributionManagement()
            {
                return distributionManagement;
            }
        };

        final DistributionManagement distributionManagementSec = new DistributionManagement();
        DeploymentRepository repositorySec = new DeploymentRepository();
        repositorySec.setId( "localhost" );
        repositorySec.setUrl( "https://localhost:8443" );
        distributionManagementSec.setRepository( repositorySec );
        distributionManagementSec.setSnapshotRepository( repositorySec );
        projectStubSec = new MavenProjectStub()
        {
            @Override
            public DistributionManagement getDistributionManagement()
            {
View Full Code Here

            }
            endTable();
            endSection();

            // download section
            DistributionManagement distributionManagement = project.getDistributionManagement();
            if ( distributionManagement != null )
            {
                if ( StringUtils.isNotEmpty( distributionManagement.getDownloadUrl() ) )
                {
                    startSection( getI18nString( "download" ) );
                    link( distributionManagement.getDownloadUrl(), distributionManagement.getDownloadUrl() );
                    endSection();
                }
            }

            endSection();
View Full Code Here

        }

        @Override
        public void renderBody()
        {
            DistributionManagement distributionManagement = project.getDistributionManagement();
            if ( distributionManagement == null )
            {
                startSection( getI18nString( "overview.title" ) );

                paragraph( getI18nString( "nodistributionmanagement" ) );

                endSection();

                return;
            }

            startSection( getI18nString( "overview.title" ) );
            paragraph( getI18nString( "overview.intro" ) );

            if ( StringUtils.isNotEmpty( distributionManagement.getDownloadUrl() ) )
            {
                startSection( getI18nString( "downloadURL" ) );
                internalLink( distributionManagement.getDownloadUrl() );
                endSection();
            }

            if ( distributionManagement.getRelocation() != null )
            {
                startSection( getI18nString( "relocation" ) );
                startTable();
                tableHeader( new String[] { getI18nString( "field" ), getI18nString( "value" ) } );
                tableRow( new String[] { getI18nString( "relocation.groupid" ),
                    distributionManagement.getRelocation().getGroupId() } );
                tableRow( new String[] { getI18nString( "relocation.artifactid" ),
                    distributionManagement.getRelocation().getArtifactId() } );
                tableRow( new String[] { getI18nString( "relocation.version" ),
                    distributionManagement.getRelocation().getVersion() } );
                tableRow( new String[] { getI18nString( "relocation.message" ),
                    distributionManagement.getRelocation().getMessage() } );
                endTable();
                endSection();
            }

            if ( distributionManagement.getRepository() != null
                && StringUtils.isNotEmpty( distributionManagement.getRepository().getUrl() ) )
            {
                startSection( getI18nString( "repository" )
                    + getRepoName( distributionManagement.getRepository().getId() ) );
                internalLink( distributionManagement.getRepository().getUrl() );
                endSection();
            }

            if ( distributionManagement.getSnapshotRepository() != null
                && StringUtils.isNotEmpty( distributionManagement.getSnapshotRepository().getUrl() ) )
            {
                startSection( getI18nString( "snapshotRepository" )
                    + getRepoName( distributionManagement.getSnapshotRepository().getId() ) );
                internalLink( distributionManagement.getSnapshotRepository().getUrl() );
                endSection();
            }

            if ( distributionManagement.getSite() != null
                && StringUtils.isNotEmpty( distributionManagement.getSite().getUrl() ) )
            {
                startSection( getI18nString( "site" ) + getRepoName( distributionManagement.getSite().getId() ) );
                internalLink( distributionManagement.getSite().getUrl() );
                endSection();
            }

            endSection();
        }
View Full Code Here

TOP

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

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.