当前位置: 首页>>代码示例>>Java>>正文


Java ConfigurationContainer类代码示例

本文整理汇总了Java中org.gradle.api.artifacts.ConfigurationContainer的典型用法代码示例。如果您正苦于以下问题:Java ConfigurationContainer类的具体用法?Java ConfigurationContainer怎么用?Java ConfigurationContainer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ConfigurationContainer类属于org.gradle.api.artifacts包,在下文中一共展示了ConfigurationContainer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: defineConfigurationsForSourceSet

import org.gradle.api.artifacts.ConfigurationContainer; //导入依赖的package包/类
private void defineConfigurationsForSourceSet(SourceSet sourceSet, ConfigurationContainer configurations) {
    Configuration compileConfiguration = configurations.maybeCreate(sourceSet.getCompileConfigurationName());
    compileConfiguration.setVisible(false);
    compileConfiguration.setDescription("Dependencies for " + sourceSet + ".");

    Configuration runtimeConfiguration = configurations.maybeCreate(sourceSet.getRuntimeConfigurationName());
    runtimeConfiguration.setVisible(false);
    runtimeConfiguration.extendsFrom(compileConfiguration);
    runtimeConfiguration.setDescription("Runtime dependencies for " + sourceSet + ".");

    Configuration compileOnlyConfiguration = configurations.maybeCreate(sourceSet.getCompileOnlyConfigurationName());
    compileOnlyConfiguration.setVisible(false);
    compileOnlyConfiguration.extendsFrom(compileConfiguration);
    compileOnlyConfiguration.setDescription("Compile dependencies for " + sourceSet + ".");

    Configuration compileClasspathConfiguration = configurations.maybeCreate(sourceSet.getCompileClasspathConfigurationName());
    compileClasspathConfiguration.setVisible(false);
    compileClasspathConfiguration.extendsFrom(compileOnlyConfiguration);
    compileClasspathConfiguration.setDescription("Compile classpath for " + sourceSet + ".");

    sourceSet.setCompileClasspath(compileClasspathConfiguration);
    sourceSet.setRuntimeClasspath(sourceSet.getOutput().plus(runtimeConfiguration));
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:24,代码来源:JavaBasePlugin.java

示例2: apply

import org.gradle.api.artifacts.ConfigurationContainer; //导入依赖的package包/类
@Override
public void apply(Project project) {
    final ConfigurationContainer configurations = project.getConfigurations();
    configurations.maybeCreate("test");
    configurations.maybeCreate("build");
    configurations.maybeCreate("tool");

    final ExtensionContainer extensions = project.getExtensions();
    final ExtensionAware golang = (ExtensionAware) extensions.create("golang", GolangSettings.class, true, project);
    golang.getExtensions().create("build", BuildSettings.class, true, project);
    golang.getExtensions().create("toolchain", ToolchainSettings.class, true, project);
    golang.getExtensions().create("dependencies", DependenciesSettings.class, true, project);
    golang.getExtensions().create("testing", TestingSettings.class, true, project);

    extensions.create(INSTANCE_PROPERTY_NAME, Reference.class, this);

    final TaskContainer tasks = project.getTasks();
    addTasks(tasks);
}
 
开发者ID:echocat,项目名称:gradle-golang-plugin,代码行数:20,代码来源:GolangPluginSupport.java

示例3: configureConfigurations

import org.gradle.api.artifacts.ConfigurationContainer; //导入依赖的package包/类
/**
 * Configure configurations
 *
 * @param configurations Configurations to configure
 * @param javaConfig Java configuration to apply
 */
@Mutate
public void configureConfigurations(ConfigurationContainer configurations, JavaConfig javaConfig) {
    configurations.all(c -> {
        DependencySubstitutions ds = c.getResolutionStrategy().getDependencySubstitution();

        ds.substitute(ds.module("ch.qos.logback:logback-classic"))
                .with(ds.module("org.slf4j:slf4j-api:" + javaConfig.getSlf4jVersion()));
        ds.substitute(ds.module("commons-logging:commons-logging"))
                .with(ds.module("org.slf4j:jcl-over-slf4j:" + javaConfig.getSlf4jVersion()));
        ds.substitute(ds.module("log4j:log4j"))
                .with(ds.module("org.slf4j:log4j-over-slf4j:" + javaConfig.getSlf4jVersion()));

        c.exclude(ImmutableMap.of("group", "org.slf4j", "module", "slf4j-log4j12"));
        c.exclude(ImmutableMap.of("group", "org.slf4j", "module", "slf4j-nop"));
        c.exclude(ImmutableMap.of("group", "org.slf4j", "module", "slf4j-simple"));
        c.exclude(ImmutableMap.of("group", "org.slf4j", "module", "slf4j-jcl"));
    });
}
 
开发者ID:jochenseeber,项目名称:gradle-project-config,代码行数:25,代码来源:JavaConfigPlugin.java

示例4: initializeMavenConfig

import org.gradle.api.artifacts.ConfigurationContainer; //导入依赖的package包/类
/**
 * Initialize the Maven configuration
 *
 * @param mavenConfig Maven configuration to initialize
 * @param projectContext Project context
 * @param configurations Configuration container
 */
@Defaults
public void initializeMavenConfig(MavenConfig mavenConfig, ProjectContext projectContext,
        ConfigurationContainer configurations) {
    mavenConfig.getPublications().create(SourceSet.MAIN_SOURCE_SET_NAME, p -> {
        p.setArtifactId(projectContext.getName());
        p.setArchivesConfiguration(Dependency.ARCHIVES_CONFIGURATION);
        p.setAddProjectArtifacts(false);
        p.setCompileConfigurations(Collections.singletonList(JavaPlugin.COMPILE_CONFIGURATION_NAME));
        p.setRuntimeConfigurations(Collections.singletonList(JavaPlugin.RUNTIME_CONFIGURATION_NAME));
    });

    if (configurations.findByName("testArchives") != null) {
        mavenConfig.getPublications().create(SourceSet.TEST_SOURCE_SET_NAME, p -> {
            p.setArtifactId(projectContext.getName() + "-" + SourceSet.TEST_SOURCE_SET_NAME);
            p.setArchivesConfiguration(Names.formatName("", Dependency.ARCHIVES_CONFIGURATION,
                    SourceSet.TEST_SOURCE_SET_NAME));
            p.setAddProjectArtifacts(true);
            p.setCompileConfigurations(
                    Collections.singletonList(JavaPlugin.TEST_COMPILE_CONFIGURATION_NAME));
            p.setRuntimeConfigurations(
                    Collections.singletonList(JavaPlugin.TEST_RUNTIME_CONFIGURATION_NAME));
        });
    }
}
 
开发者ID:jochenseeber,项目名称:gradle-project-config,代码行数:32,代码来源:MavenConfigPlugin.java

示例5: createEclipseAnnotationsTasks

import org.gradle.api.artifacts.ConfigurationContainer; //导入依赖的package包/类
/**
 * Create Eclipse annotations tasks
 *
 * @param tasks Task container
 * @param configurations Container to access configurations
 * @param buildDir Build directory
 */
@Mutate
public void createEclipseAnnotationsTasks(ModelMap<Task> tasks, ConfigurationContainer configurations,
        @Path("buildDir") File buildDir) {
    tasks.create("eclipseAnnotations", EclipseAnnotationsTask.class, t -> {
        t.setDescription("Generates external nullability annotations for dependencies.");
        t.setGroup("IDE");

        ConventionMapping parameters = t.getConventionMapping();
        parameters.map("jars", () -> {
            Set<File> jars = configurations.stream()
                    .filter(c -> c.isCanBeResolved()
                            && !c.getName().equals(JavaConfigPlugin.ANNOTATIONS_CONFIGURATION))
                    .map(c -> c.getResolvedConfiguration().getLenientConfiguration())
                    .flatMap(c -> c.getArtifacts().stream().filter(
                            a -> !(a.getId().getComponentIdentifier() instanceof ProjectComponentIdentifier)
                                    && a.getType().equals("jar"))
                            .map(a -> a.getFile()))
                    .collect(Collectors.toSet());

            return jars;
        });
    });
}
 
开发者ID:jochenseeber,项目名称:gradle-project-config,代码行数:31,代码来源:EclipseConfigPlugin.java

示例6: finalizeEclipseClasspathTask

import org.gradle.api.artifacts.ConfigurationContainer; //导入依赖的package包/类
/**
 * @param eclipseClasspath
 * @param eclipseConfigPlugin
 * @param configurations
 */
@Finalize
public void finalizeEclipseClasspathTask(@Each GenerateEclipseClasspath eclipseClasspath,
        EclipseConfigPlugin eclipseConfigPlugin, ConfigurationContainer configurations) {
    EclipseClasspath classpath = eclipseClasspath.getClasspath();

    Configuration integrationCompileConfiguration = configurations.getAsMap()
            .get(JavaConfigPlugin.INTEGRATION_COMPILE_CLASSPATH_CONFIGURATION);

    if (integrationCompileConfiguration != null) {
        classpath.getPlusConfigurations().add(integrationCompileConfiguration);
    }

    Configuration integrationRuntimeConfiguration = configurations.getAsMap()
            .get(JavaConfigPlugin.INTEGRATION_RUNTIME_CLASSPATH_CONFIGURATION);

    if (integrationRuntimeConfiguration != null) {
        classpath.getPlusConfigurations().add(integrationRuntimeConfiguration);
    }

    classpath.getFile().whenMerged((Classpath c) -> {
        c.getEntries().removeIf(e -> (e instanceof Library)
                && Files.getFileExtension(((Library) e).getPath()).equalsIgnoreCase("pom"));
    });
}
 
开发者ID:jochenseeber,项目名称:gradle-project-config,代码行数:30,代码来源:EclipseConfigPlugin.java

示例7: createCompileTask

import org.gradle.api.artifacts.ConfigurationContainer; //导入依赖的package包/类
private void createCompileTask(final Project project) {
	project.getTasks().create(GwtCompileTask.NAME, GwtCompileTask.class);
	final PutnamiExtension extension = project.getExtensions().getByType(PutnamiExtension.class);
	final War warTask = project.getTasks().withType(War.class).getByName("war");
	warTask.dependsOn(GwtCompileTask.NAME);
	project.getTasks().withType(GwtCompileTask.class, new Action<GwtCompileTask>() {
		@Override
		public void execute(final GwtCompileTask task) {
			task.configure(project, extension);
			warTask.from(extension.getCompile().getWar());
		}
	});

	ConfigurationContainer configurationContainer = project.getConfigurations();
	//		Configuration gwtConfig = configurationContainer.getByName(PwtLibPlugin.CONF_GWT_SDM);
	//		FileCollection warClasspath = warTask.getClasspath().minus(gwtConfig);
	//		warTask.setClasspath(warClasspath);
}
 
开发者ID:Putnami,项目名称:putnami-gradle-plugin,代码行数:19,代码来源:PwtPlugin.java

示例8: listProjectDepsSrcDirs

import org.gradle.api.artifacts.ConfigurationContainer; //导入依赖的package包/类
private Collection<File> listProjectDepsSrcDirs(Project project) {
	ConfigurationContainer configs = project.getConfigurations();
	Configuration compileConf = configs.getByName(JavaPlugin.COMPILE_CLASSPATH_CONFIGURATION_NAME);
	DependencySet depSet = compileConf.getAllDependencies();

	List<File> result = Lists.newArrayList();
	for (Dependency dep : depSet) {
		if (dep instanceof ProjectDependency) {
			Project projectDependency = ((ProjectDependency) dep).getDependencyProject();
			if (projectDependency.getPlugins().hasPlugin(PwtLibPlugin.class)) {
				JavaPluginConvention javaConvention = projectDependency.getConvention().getPlugin(JavaPluginConvention.class);
				SourceSet mainSourceSet = javaConvention.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME);

				result.addAll(mainSourceSet.getAllSource().getSrcDirs());
			}
		}
	}
	return result;
}
 
开发者ID:Putnami,项目名称:putnami-gradle-plugin,代码行数:20,代码来源:CodeServerBuilder.java

示例9: configure

import org.gradle.api.artifacts.ConfigurationContainer; //导入依赖的package包/类
public void configure(Project project, JettyOption jettyOption, File jettyConf) {
	ConfigurationContainer configs = project.getConfigurations();

	Configuration runtimeConf = configs.getByName(WarPlugin.PROVIDED_RUNTIME_CONFIGURATION_NAME);
	Configuration jettyClassPath = configs.getByName(PwtLibPlugin.CONF_JETTY);

	configureJavaArgs(jettyOption);

	addClassPath(jettyClassPath.getAsPath());
	addClassPath(runtimeConf.getAsPath());

	if (jettyOption.getLogRequestFile() != null) {
		ResourceUtils.ensureDir(jettyOption.getLogRequestFile().getParentFile());
		addArg("--log", jettyOption.getLogRequestFile());
	}
	if (jettyOption.getLogFile() != null) {
		ResourceUtils.ensureDir(jettyOption.getLogFile().getParentFile());
		addArg("--out", jettyOption.getLogFile());
	}
	addArg("--host", jettyOption.getBindAddress());
	addArg("--port", jettyOption.getPort());
	addArg("--stop-port", jettyOption.getStopPort());
	addArg("--stop-key", jettyOption.getStopKey());

	addArg(jettyConf.getAbsolutePath());
}
 
开发者ID:Putnami,项目名称:putnami-gradle-plugin,代码行数:27,代码来源:JettyServerBuilder.java

示例10: configureProvidedConfigurations

import org.gradle.api.artifacts.ConfigurationContainer; //导入依赖的package包/类
/**
 * Setup the the 'providedCompile' and 'providedRuntime' configurations, just like War.
 * TODO See if we can recursively get all the dependent projects and apply it to them too.
 * But it would have to be a future action.
 */
public static void configureProvidedConfigurations(final Project project) {
  ConfigurationContainer configurationContainer = project.getConfigurations();
  Configuration provideCompileConfiguration = configurationContainer.findByName(WarPlugin.PROVIDED_COMPILE_CONFIGURATION_NAME);
  if (provideCompileConfiguration==null) {
    provideCompileConfiguration = configurationContainer.create(WarPlugin.PROVIDED_COMPILE_CONFIGURATION_NAME)
                                  .setVisible(false)
                                  .setDescription("Additional compile classpath for libraries that should not be part of the archive.");
    configurationContainer.getByName(JavaPlugin.COMPILE_CONFIGURATION_NAME).extendsFrom(provideCompileConfiguration);
  }
  Configuration provideRuntimeConfiguration = configurationContainer.findByName(WarPlugin.PROVIDED_RUNTIME_CONFIGURATION_NAME);
  if (provideRuntimeConfiguration==null) {
    provideRuntimeConfiguration = configurationContainer.create(WarPlugin.PROVIDED_RUNTIME_CONFIGURATION_NAME)
                                  .setVisible(false)
                                  .extendsFrom(provideCompileConfiguration)
                                  .setDescription("Additional runtime classpath for libraries that should not be part of the archive.");
    configurationContainer.getByName(JavaPlugin.RUNTIME_CONFIGURATION_NAME).extendsFrom(provideRuntimeConfiguration);
  }
}
 
开发者ID:r-murphy,项目名称:nw-gradle,代码行数:24,代码来源:DependenciesUtil.java

示例11: before

import org.gradle.api.artifacts.ConfigurationContainer; //导入依赖的package包/类
@TaskAction
public void before() {
    final JMHPluginExtension extension = getProject().getExtensions().getByType(JMHPluginExtension.class);
    extension.resolveArgs();
    final ExtensionOptions options = new ExtensionOptions(extension);
    extension.getResultsFile().getParentFile().mkdirs();
    workerExecutor.submit(IsolatedRunner.class, new Action<WorkerConfiguration>() {
        @Override
        public void execute(final WorkerConfiguration workerConfiguration) {
            workerConfiguration.setIsolationMode(IsolationMode.PROCESS);
            ConfigurationContainer configurations = getProject().getConfigurations();
            FileCollection classpath = configurations.getByName("jmh").plus(getProject().files(getJarArchive()));
            if (extension.isIncludeTests()) {
                classpath = classpath.plus(configurations.getByName("testRuntimeClasspath"));
            }
            workerConfiguration.classpath(classpath);
            workerConfiguration.params(options.asSerializable());
            workerConfiguration.getForkOptions().getSystemProperties().put(JAVA_IO_TMPDIR, getTemporaryDir());
        }
    });
}
 
开发者ID:melix,项目名称:jmh-gradle-plugin,代码行数:22,代码来源:JMHTask.java

示例12: establishSonarQubeSourceSet

import org.gradle.api.artifacts.ConfigurationContainer; //导入依赖的package包/类
public void establishSonarQubeSourceSet()
{
    final JavaPluginConvention javaConvention = project.getConvention().getPlugin(JavaPluginConvention.class);
    final SourceSetContainer sourceSets = javaConvention.getSourceSets();
    final ConfigurationContainer configs = project.getConfigurations();

    final SourceSet testSourceSet = sourceSets.getByName(SourceSet.TEST_SOURCE_SET_NAME);
    final SourceSet sqSourceSet = sourceSets.create(BuildUtil.SONARQUBE_SOURCE_SET_NAME);

    configs.getByName(testSourceSet.getImplementationConfigurationName()).extendsFrom(
        configs.getByName(sqSourceSet.getImplementationConfigurationName()));
    configs.getByName(testSourceSet.getRuntimeOnlyConfigurationName()).extendsFrom(
        configs.getByName(sqSourceSet.getRuntimeOnlyConfigurationName()));

    final TaskContainer tasks = project.getTasks();
    tasks.getByName(JavaPlugin.COMPILE_TEST_JAVA_TASK_NAME).dependsOn(
        tasks.getByName(sqSourceSet.getClassesTaskName()));

    final FileCollection sqOutputs = sqSourceSet.getOutput().getClassesDirs().plus(
        project.files(sqSourceSet.getOutput().getResourcesDir()));
    testSourceSet.setCompileClasspath(testSourceSet.getCompileClasspath().plus(sqOutputs));
    testSourceSet.setRuntimeClasspath(testSourceSet.getRuntimeClasspath().plus(sqOutputs));
}
 
开发者ID:checkstyle-addons,项目名称:checkstyle-addons,代码行数:24,代码来源:TaskCreator.java

示例13: DefaultMavenPomFactory

import org.gradle.api.artifacts.ConfigurationContainer; //导入依赖的package包/类
public DefaultMavenPomFactory(ConfigurationContainer configurationContainer, Conf2ScopeMappingContainer conf2ScopeMappingContainer, PomDependenciesConverter pomDependenciesConverter,
                              FileResolver fileResolver) {
    this.configurationContainer = configurationContainer;
    this.conf2ScopeMappingContainer = conf2ScopeMappingContainer;
    this.pomDependenciesConverter = pomDependenciesConverter;
    this.fileResolver = fileResolver;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:8,代码来源:DefaultMavenPomFactory.java

示例14: DefaultMavenPom

import org.gradle.api.artifacts.ConfigurationContainer; //导入依赖的package包/类
public DefaultMavenPom(ConfigurationContainer configurationContainer, Conf2ScopeMappingContainer scopeMappings, PomDependenciesConverter pomDependenciesConverter,
                       PathToFileResolver fileResolver) {
    this.configurations = configurationContainer;
    this.scopeMappings = scopeMappings;
    this.pomDependenciesConverter = pomDependenciesConverter;
    this.fileResolver = fileResolver;
    model.setModelVersion("4.0.0");
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:9,代码来源:DefaultMavenPom.java

示例15: DefaultDeployerFactory

import org.gradle.api.artifacts.ConfigurationContainer; //导入依赖的package包/类
public DefaultDeployerFactory(MavenFactory mavenFactory, Factory<LoggingManagerInternal> loggingManagerFactory, FileResolver fileResolver, MavenPomMetaInfoProvider pomMetaInfoProvider,
                              ConfigurationContainer configurationContainer, Conf2ScopeMappingContainer scopeMapping, 
                              MavenSettingsProvider mavenSettingsProvider, LocalMavenRepositoryLocator mavenRepositoryLocator) {
    this.mavenFactory = mavenFactory;
    this.loggingManagerFactory = loggingManagerFactory;
    this.fileResolver = fileResolver;
    this.pomMetaInfoProvider = pomMetaInfoProvider;
    this.configurationContainer = configurationContainer;
    this.scopeMapping = scopeMapping;
    this.mavenSettingsProvider = mavenSettingsProvider;
    this.mavenRepositoryLocator = mavenRepositoryLocator;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:13,代码来源:DefaultDeployerFactory.java


注:本文中的org.gradle.api.artifacts.ConfigurationContainer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。