Package org.apache.maven.continuum.project.builder

Examples of org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult


        assertEquals( 1, projectGroupsBefore );

        String url = getTestFile( "src/test-projects/project1/pom.xml" ).toURL().toExternalForm();

        ContinuumProjectBuildingResult result = continuum.addMavenTwoProject( url );

        assertNotNull( result );

        assertEquals( 1, result.getProjectGroups().size() );

        ProjectGroup projectGroup = (ProjectGroup) result.getProjectGroups().get( 0 );

        assertEquals( "plexus", projectGroup.getGroupId() );

        projectGroupList = continuum.getAllProjectGroupsWithProjects();
View Full Code Here


        assertEquals( 1, projectGroupsBefore );

        String url = getTestFile( "src/test-projects/project1/pom.xml" ).toURL().toExternalForm();

        ContinuumProjectBuildingResult result = continuum.addMavenTwoProject( url );

        assertNotNull( result );

        assertEquals( 1, result.getProjectGroups().size() );

        ProjectGroup projectGroup = (ProjectGroup) result.getProjectGroups().get( 0 );

        continuum.addGroupNotifier( projectGroup.getId(), new ProjectNotifier() );

        for ( Iterator i = projectGroup.getProjects().iterator(); i.hasNext(); )
        {
View Full Code Here

       
        BuildsManager parallelBuildsManager = continuum.getBuildsManager();
       
        String url = getTestFile( "src/test-projects/project1/pom.xml" ).toURL().toExternalForm();

        ContinuumProjectBuildingResult result = continuum.addMavenTwoProject( url );

        assertNotNull( result );

        List projects = result.getProjects();

        assertEquals( 1, projects.size() );

        assertEquals( Project.class, projects.get( 0 ).getClass() );
View Full Code Here

        URL url;

        ContinuumProjectBuilder projectBuilder = projectBuilderManager.getProjectBuilder( projectBuilderId );

        ContinuumProjectBuildingResult result;

        try
        {
            BuildDefinitionTemplate buildDefinitionTemplate = getBuildDefinitionTemplate( context );
            if ( buildDefinitionTemplate == null )
            {
                buildDefinitionTemplate = projectBuilder.getDefaultBuildDefinitionTemplate();
            }           
            if ( !curl.startsWith( "http" ) )
            {
                url = new URL( curl );

                result = projectBuilder.buildProjectsFromMetadata( url, null, null, loadRecursiveProjects,
                                                                   buildDefinitionTemplate );

            }
            else
            {
                url = new URL( curl );
                String username = null;
                String password = null;

                try
                {
                    Settings settings = getSettings();

                    getLogger().info( "checking for settings auth setup" );
                    if ( settings != null && settings.getServer( url.getHost() ) != null )
                    {
                        getLogger().info( "found setting based auth setup, using" );
                        Server server = settings.getServer( url.getHost() );

                        username = server.getUsername();
                        password = server.getPassword();
                    }
                }
                catch ( SettingsConfigurationException se )
                {
                    getLogger().warn( "problem with settings file, disabling scm resolution of username and password" );
                }

                if ( username == null )
                {
                    URLUserInfo urlUserInfo = urlValidator.extractURLUserInfo( curl );
                    username = urlUserInfo.getUsername();
                    password = urlUserInfo.getPassword();
                }

                if ( urlValidator.isValid( curl ) )
                {

                    result = projectBuilder.buildProjectsFromMetadata( url, username, password, loadRecursiveProjects,
                                                                       buildDefinitionTemplate );

                }
                else
                {
                    result = new ContinuumProjectBuildingResult();
                    getLogger().info( "Malformed URL (MungedHttpsURL is not valid): " + hidePasswordInUrl( curl ) );
                    result.addError( ContinuumProjectBuildingResult.ERROR_MALFORMED_URL );
                }
            }
    
            if ( result.getProjects() != null )
            {
                String scmRootUrl = getScmRootUrl( result.getProjects() );
        
                if ( scmRootUrl == null || scmRootUrl.equals( "" ) )
                {
                    if ( curl.indexOf( "pom.xml" ) > 0 )
                    {
                        scmRootUrl = curl.substring( 0, curl.indexOf( "pom.xml" ) - 1 );
                    }
                    else
                    {
                        scmRootUrl = curl;
                    }
                }

                context.put( KEY_URL, scmRootUrl );
            }
        }
        catch ( MalformedURLException e )
        {
            getLogger().info( "Malformed URL: " + hidePasswordInUrl( curl ), e );
            result = new ContinuumProjectBuildingResult();
            result.addError( ContinuumProjectBuildingResult.ERROR_MALFORMED_URL );
        }
        catch ( URISyntaxException e )
        {
            getLogger().info( "Malformed URL: " + hidePasswordInUrl( curl ), e );
            result = new ContinuumProjectBuildingResult();
            result.addError( ContinuumProjectBuildingResult.ERROR_MALFORMED_URL );
        }

        context.put( KEY_PROJECT_BUILDING_RESULT, result );
    }
View Full Code Here

    public AddingResult addMavenTwoProject( String url )
        throws ContinuumException
    {
        checkAddProjectGroupAuthorization();

        ContinuumProjectBuildingResult result = continuum.addMavenTwoProject( url );
        return populateAddingResult( result );
    }
View Full Code Here

    public AddingResult addMavenTwoProject( String url, int projectGroupId )
        throws ContinuumException
    {
        checkAddProjectToGroupAuthorization( getProjectGroupName( projectGroupId ) );

        ContinuumProjectBuildingResult result = continuum.addMavenTwoProject( url, projectGroupId );
        return populateAddingResult( result );
    }
View Full Code Here

    public AddingResult addMavenOneProject( String url )
        throws ContinuumException
    {
        checkAddProjectGroupAuthorization();

        ContinuumProjectBuildingResult result = continuum.addMavenOneProject( url );
        return populateAddingResult( result );
    }
View Full Code Here

    public AddingResult addMavenOneProject( String url, int projectGroupId )
        throws ContinuumException
    {
        checkAddProjectToGroupAuthorization( getProjectGroupName( projectGroupId ) );

        ContinuumProjectBuildingResult result = continuum.addMavenOneProject( url, projectGroupId );
        return populateAddingResult( result );
    }
View Full Code Here

        if ( !f.exists() )
        {
            throw new ContinuumBuildExecutorException( "Could not find Maven project descriptor." );
        }

        ContinuumProjectBuildingResult result = new ContinuumProjectBuildingResult();

        builderHelper.mapMetadataToProject( result, f, project );

        if ( result.hasErrors() )
        {
            throw new ContinuumBuildExecutorException( "Error while mapping metadata:" + result.getErrorsAsString() );
        }
    }
View Full Code Here

    private MavenProject getMavenProject( Project continuumProject, File workingDirectory,
                                          BuildDefinition buildDefinition )
        throws ContinuumBuildExecutorException
    {
        ContinuumProjectBuildingResult result = new ContinuumProjectBuildingResult();

        File f = getPomFile( getBuildFileForProject( continuumProject, buildDefinition ), workingDirectory );

        if ( !f.exists() )
        {
            throw new ContinuumBuildExecutorException( "Could not find Maven project descriptor '" + f + "'." );
        }

        MavenProject project = builderHelper.getMavenProject( result, f );

        if ( result.hasErrors() )
        {
            throw new ContinuumBuildExecutorException(
                "Unable to read the Maven project descriptor '" + f + "': " + result.getErrorsAsString() );
        }
        return project;
    }
View Full Code Here

TOP

Related Classes of org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult

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.