Package org.apache.maven.settings.building

Examples of org.apache.maven.settings.building.SettingsBuildingResult


                .setGlobalSettingsFile(globalSettingsFile)
                .setUserSettingsFile(userSettingsFile)
                .setSystemProperties(request.getSystemProperties())
                .setUserProperties(request.getUserProperties());

            SettingsBuildingResult settingsResult;
            SettingsBuilder settingsBuilder = container.lookup(SettingsBuilder.class);
            try {
                settingsResult = settingsBuilder.build(settingsRequest);
            }
            finally {
                container.release(settingsBuilder);
            }

            // NOTE: This will nuke some details from the request; profiles, online, etc... :-(
            MavenExecutionRequestPopulator populator = container.lookup(MavenExecutionRequestPopulator.class);
            try {
                populator.populateFromSettings(request, settingsResult.getEffectiveSettings());
            }
            finally {
                container.release(populator);
            }

            if (!settingsResult.getProblems().isEmpty() && logger.isWarnEnabled()) {
                logger.warn("");
                logger.warn("Some problems were encountered while building the effective settings"); // TODO: i18n

                for (SettingsProblem problem : settingsResult.getProblems()) {
                    logger.warn(problem.getMessage() + " @ " + problem.getLocation()); // TODO: i18n
                }

                logger.warn("");
            }
View Full Code Here


                  .setUserSettingsFile(new File(OSUtils.getUserHomeDir().getAbsolutePath() + "/.m2/settings.xml"));

         if (M2_HOME != null)
            settingsRequest.setGlobalSettingsFile(new File(M2_HOME + "/conf/settings.xml"));

         SettingsBuildingResult settingsBuildingResult = settingsBuilder.build(settingsRequest);
         Settings effectiveSettings = settingsBuildingResult.getEffectiveSettings();

         if (effectiveSettings.getLocalRepository() == null)
         {
            effectiveSettings.setLocalRepository(OSUtils.getUserHomeDir().getAbsolutePath() + "/.m2/repository");
         }
View Full Code Here

    DefaultSettingsBuildingRequest request = new DefaultSettingsBuildingRequest();
    request.setSystemProperties( System.getProperties() );
    FileSettingsSource fileSource = new FileSettingsSource( new File("src/test/resources/settings/proxy/nonproxy-github.xml").getAbsoluteFile() );
    request.setUserSettingsSource( fileSource );

    SettingsBuildingResult result = builder.build( request );
    assertNotNull( result );
    assertNotNull( result.getEffectiveSettings() );

    TestMojo mojo = new TestMojo();
    assertNotNull( mojo );

    assertNotNull( result.getEffectiveSettings().getProxies() );
    for ( final Proxy proxy : result.getEffectiveSettings().getProxies() )
    {
      {
        final boolean isNonProxy = mojo.matchNonProxy( proxy, IGitHubConstants.HOST_DEFAULT );
        assertTrue( isNonProxy );
      }
View Full Code Here

    DefaultSettingsBuildingRequest request = new DefaultSettingsBuildingRequest();
    request.setSystemProperties( System.getProperties() );
    FileSettingsSource fileSource = new FileSettingsSource( new File("src/test/resources/settings/proxy/nonproxy-github_and_api.xml").getAbsoluteFile() );
    request.setUserSettingsSource( fileSource );

    SettingsBuildingResult result = builder.build( request );
    assertNotNull( result );
    assertNotNull( result.getEffectiveSettings() );

    TestMojo mojo = new TestMojo();
    assertNotNull( mojo );

    assertNotNull( result.getEffectiveSettings().getProxies() );
    for ( final Proxy proxy : result.getEffectiveSettings().getProxies() )
    {
      {
        final boolean isNonProxy = mojo.matchNonProxy( proxy, IGitHubConstants.HOST_DEFAULT );
        assertTrue( isNonProxy );
      }
View Full Code Here

    DefaultSettingsBuildingRequest request = new DefaultSettingsBuildingRequest();
    request.setSystemProperties( System.getProperties() );
    FileSettingsSource fileSource = new FileSettingsSource( new File("src/test/resources/settings/proxy/nonproxy-github_wildcard.xml").getAbsoluteFile() );
    request.setUserSettingsSource( fileSource );

    SettingsBuildingResult result = builder.build( request );
    assertNotNull( result );
    assertNotNull( result.getEffectiveSettings() );

    TestMojo mojo = new TestMojo();
    assertNotNull( mojo );

    assertNotNull( result.getEffectiveSettings().getProxies() );
    for ( final Proxy proxy : result.getEffectiveSettings().getProxies() )
    {
      {
        final boolean isNonProxy = mojo.matchNonProxy( proxy, IGitHubConstants.HOST_DEFAULT );
        assertTrue( isNonProxy );
      }
View Full Code Here

    DefaultSettingsBuildingRequest request = new DefaultSettingsBuildingRequest();
    request.setSystemProperties( System.getProperties() );
    FileSettingsSource fileSource = new FileSettingsSource( new File("src/test/resources/settings/proxy/nonproxy-github.xml").getAbsoluteFile() );
    request.setUserSettingsSource( fileSource );

    SettingsBuildingResult result = builder.build( request );
    assertNotNull( result );
    assertNotNull( result.getEffectiveSettings() );

    TestMojo mojo = new TestMojo();
    assertNotNull( mojo );

    {
      Proxy proxy = mojo.getProxy( result.getEffectiveSettings(), "intra_github-test-nonproxy", mojo.host.get() );
      assertNull( proxy );
    }
    {
      Proxy proxy = mojo.getProxy( result.getEffectiveSettings(), "intra_github-test-nonproxy", "intra-github.com" );
      assertNotNull( proxy );
    }
  }
View Full Code Here

    DefaultSettingsBuildingRequest request = new DefaultSettingsBuildingRequest();
    request.setSystemProperties( System.getProperties() );
    FileSettingsSource fileSource = new FileSettingsSource( new File("src/test/resources/settings/proxy/nonproxy-intra_github.xml").getAbsoluteFile() );
    request.setUserSettingsSource( fileSource );

    SettingsBuildingResult result = builder.build( request );
    assertNotNull( result );
    assertNotNull( result.getEffectiveSettings() );

    TestMojo mojo = new TestMojo();
    assertNotNull( mojo );

    {
      Proxy proxy = mojo.getProxy( result.getEffectiveSettings(), "intra_github-test-nonproxy", mojo.host.get() );
      assertNotNull( proxy );
    }
    {
      Proxy proxy = mojo.getProxy( result.getEffectiveSettings(), "intra_github-test-nonproxy", "intra-github.com" );
      assertNull( proxy );
    }
    {
      Proxy proxy = mojo.getProxy( result.getEffectiveSettings(), "intra_github-test-nonproxy", "intra_github.com" );
      assertNotNull( proxy );
    }
  }
View Full Code Here

    DefaultSettingsBuildingRequest request = new DefaultSettingsBuildingRequest();
    request.setSystemProperties( System.getProperties() );
    FileSettingsSource fileSource = new FileSettingsSource( new File("src/test/resources/settings/proxy/nonproxy-intra_github-no_same_id.xml").getAbsoluteFile() );
    request.setUserSettingsSource( fileSource );

    SettingsBuildingResult result = builder.build( request );
    assertNotNull( result );
    assertNotNull( result.getEffectiveSettings() );

    TestMojo mojo = new TestMojo();
    assertNotNull( mojo );

    {
      Proxy proxy = mojo.getProxy( result.getEffectiveSettings(), "intra_github-test-nonproxy", mojo.host.get() );
      assertNotNull( proxy );
    }
    {
      Proxy proxy = mojo.getProxy( result.getEffectiveSettings(), "intra_github-test-nonproxy", "intra-github.com" );
      assertNull( proxy );
    }
    {
      Proxy proxy = mojo.getProxy( result.getEffectiveSettings(), "intra_github-test-nonproxy", "intra_github.com" );
      assertNotNull( proxy );
    }
  }
View Full Code Here

                  .setUserSettingsFile(new File(OSUtils.getUserHomeDir().getAbsolutePath() + "/.m2/settings.xml"));

         if (M2_HOME != null)
            settingsRequest.setGlobalSettingsFile(new File(M2_HOME + "/conf/settings.xml"));

         SettingsBuildingResult settingsBuildingResult = settingsBuilder.build(settingsRequest);
         Settings effectiveSettings = settingsBuildingResult.getEffectiveSettings();

         if (effectiveSettings.getLocalRepository() == null)
         {
            effectiveSettings.setLocalRepository(OSUtils.getUserHomeDir().getAbsolutePath() + "/.m2/repository");
         }
View Full Code Here

        settingsRequest.setGlobalSettingsFile( globalSettingsFile );
        settingsRequest.setUserSettingsFile( userSettingsFile );
        settingsRequest.setSystemProperties( cliRequest.request.getSystemProperties() );
        settingsRequest.setUserProperties( cliRequest.request.getUserProperties() );

        SettingsBuildingResult settingsResult = settingsBuilder.build( settingsRequest );

        executionRequestPopulator.populateFromSettings( cliRequest.request, settingsResult.getEffectiveSettings() );

        if ( !settingsResult.getProblems().isEmpty() && logger.isWarnEnabled() )
        {
            logger.warn( "" );
            logger.warn( "Some problems were encountered while building the effective settings" );

            for ( SettingsProblem problem : settingsResult.getProblems() )
            {
                logger.warn( problem.getMessage() + " @ " + problem.getLocation() );
            }

            logger.warn( "" );
View Full Code Here

TOP

Related Classes of org.apache.maven.settings.building.SettingsBuildingResult

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.