Search in sources :

Example 1 with RepositoryConfiguration

use of org.springframework.boot.cli.compiler.grape.RepositoryConfiguration in project spring-boot by spring-projects.

the class RepositoryConfigurationFactoryTests method assertRepositoryConfiguration.

private void assertRepositoryConfiguration(List<RepositoryConfiguration> configurations, String... expectedNames) {
    assertThat(configurations).hasSize(expectedNames.length);
    Set<String> actualNames = new HashSet<>();
    for (RepositoryConfiguration configuration : configurations) {
        actualNames.add(configuration.getName());
    }
    assertThat(actualNames).containsOnly(expectedNames);
}
Also used : RepositoryConfiguration(org.springframework.boot.cli.compiler.grape.RepositoryConfiguration) HashSet(java.util.HashSet)

Example 2 with RepositoryConfiguration

use of org.springframework.boot.cli.compiler.grape.RepositoryConfiguration in project spring-boot by spring-projects.

the class GroovyGrabDependencyResolverTests method setupResolver.

@Before
public void setupResolver() {
    GroovyCompilerConfiguration configuration = new GroovyCompilerConfiguration() {

        @Override
        public boolean isGuessImports() {
            return true;
        }

        @Override
        public boolean isGuessDependencies() {
            return true;
        }

        @Override
        public boolean isAutoconfigure() {
            return false;
        }

        @Override
        public GroovyCompilerScope getScope() {
            return GroovyCompilerScope.DEFAULT;
        }

        @Override
        public List<RepositoryConfiguration> getRepositoryConfiguration() {
            return RepositoryConfigurationFactory.createDefaultRepositoryConfiguration();
        }

        @Override
        public String[] getClasspath() {
            return new String[] { "." };
        }
    };
    this.resolver = new GroovyGrabDependencyResolver(configuration);
}
Also used : GroovyCompilerConfiguration(org.springframework.boot.cli.compiler.GroovyCompilerConfiguration) RepositoryConfiguration(org.springframework.boot.cli.compiler.grape.RepositoryConfiguration) Before(org.junit.Before)

Example 3 with RepositoryConfiguration

use of org.springframework.boot.cli.compiler.grape.RepositoryConfiguration in project spring-boot by spring-projects.

the class RepositoryConfigurationFactory method createDefaultRepositoryConfiguration.

/**
	 * Create a new default repository configuration.
	 * @return the newly-created default repository configuration
	 */
public static List<RepositoryConfiguration> createDefaultRepositoryConfiguration() {
    MavenSettings mavenSettings = new MavenSettingsReader().readSettings();
    List<RepositoryConfiguration> repositoryConfiguration = new ArrayList<>();
    repositoryConfiguration.add(MAVEN_CENTRAL);
    if (!Boolean.getBoolean("disableSpringSnapshotRepos")) {
        repositoryConfiguration.add(SPRING_MILESTONE);
        repositoryConfiguration.add(SPRING_SNAPSHOT);
    }
    addDefaultCacheAsRepository(mavenSettings.getLocalRepository(), repositoryConfiguration);
    addActiveProfileRepositories(mavenSettings.getActiveProfiles(), repositoryConfiguration);
    return repositoryConfiguration;
}
Also used : MavenSettingsReader(org.springframework.boot.cli.compiler.maven.MavenSettingsReader) ArrayList(java.util.ArrayList) RepositoryConfiguration(org.springframework.boot.cli.compiler.grape.RepositoryConfiguration) MavenSettings(org.springframework.boot.cli.compiler.maven.MavenSettings)

Aggregations

RepositoryConfiguration (org.springframework.boot.cli.compiler.grape.RepositoryConfiguration)3 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 Before (org.junit.Before)1 GroovyCompilerConfiguration (org.springframework.boot.cli.compiler.GroovyCompilerConfiguration)1 MavenSettings (org.springframework.boot.cli.compiler.maven.MavenSettings)1 MavenSettingsReader (org.springframework.boot.cli.compiler.maven.MavenSettingsReader)1