本文整理了Java中org.gradle.api.plugins.Convention.getPlugin()
方法的一些代码示例,展示了Convention.getPlugin()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Convention.getPlugin()
方法的具体详情如下:
包路径:org.gradle.api.plugins.Convention
类名称:Convention
方法名:getPlugin
暂无
代码示例来源:origin: jooby-project/jooby
public JavaPluginConvention getJavaConvention(final Project project) {
return project.getConvention().getPlugin(JavaPluginConvention.class);
}
代码示例来源:origin: io.github.gradle-clojure/gradle-clojure-plugin
@Override
public void apply(Project project) {
project.getPlugins().apply(ClojureBasePlugin.class);
project.getPlugins().apply(ClojureCommonPlugin.class);
ClojureExtension extension = project.getExtensions().getByType(ClojureExtension.class);
configureBuilds(project, extension);
JavaPluginConvention javaConvention = project.getConvention().getPlugin(JavaPluginConvention.class);
ClojureCommonPlugin.configureDevSource(javaConvention, sourceSet -> {
ClojureSourceSet src = (ClojureSourceSet) new DslObject(sourceSet).getConvention().getPlugins().get("clojure");
return src.getClojure();
});
}
代码示例来源:origin: uber/okbuck
@Nullable
public String getMainClass() {
return getProject()
.getConvention()
.getPlugin(ApplicationPluginConvention.class)
.getMainClassName();
}
代码示例来源:origin: gradle.plugin.org.gosu-lang.gosu/gradle-gosu-plugin
private void configureSourceSetDefaults(final JavaBasePlugin javaBasePlugin) {
_project.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().all( sourceSet -> {
DefaultGosuSourceSet gosuSourceSet = new DefaultGosuSourceSet(((DefaultSourceSet) sourceSet).getDisplayName(), _fileResolver);
new DslObject(sourceSet).getConvention().getPlugins().put("gosu", gosuSourceSet);
gosuSourceSet.getGosu().srcDir("src/" + sourceSet.getName() + "/gosu");
sourceSet.getResources().getFilter().exclude( element -> {
return gosuSourceSet.getGosu().contains(element.getFile());
});
sourceSet.getAllSource().source(gosuSourceSet.getGosu());
configureGosuCompile(javaBasePlugin, sourceSet, gosuSourceSet);
});
}
代码示例来源:origin: uber/okbuck
public JvmTarget(
Project project, String name, String aptConfigurationName, String testAptConfigurationName) {
super(project, name);
this.aptConfigurationName = aptConfigurationName;
this.testAptConfigurationName = testAptConfigurationName;
sourceSets = getProject().getConvention().getPlugin(JavaPluginConvention.class).getSourceSets();
isKotlin =
project.getPlugins().stream().anyMatch(plugin -> plugin instanceof KotlinBasePluginWrapper);
Optional<Task> compileTask =
project.getTasks().stream().filter(it -> it instanceof AbstractCompile).findFirst();
if (compileTask.isPresent()) {
fakeCompile = (AbstractCompile) compileTask.get();
} else {
fakeCompile = null;
}
}
代码示例来源:origin: uber/okbuck
public String getMavenCoords() {
String group = getProject().getGroup().toString();
String id =
getProject().getConvention().getPlugin(BasePluginConvention.class).getArchivesBaseName();
String version = getProject().getVersion().toString();
return String.join(":", group, id, version);
}
代码示例来源:origin: uber/okbuck
public String getTargetCompatibility() {
return javaVersion(
getProject()
.getConvention()
.getPlugin(JavaPluginConvention.class)
.getTargetCompatibility());
}
代码示例来源:origin: uber/okbuck
public String getSourceCompatibility() {
return javaVersion(
getProject()
.getConvention()
.getPlugin(JavaPluginConvention.class)
.getSourceCompatibility());
}
代码示例来源:origin: diffplug/spotless
protected void setupTask(SpotlessTask task) {
if (target == null) {
JavaPluginConvention convention = getProject().getConvention().getPlugin(JavaPluginConvention.class);
if (convention == null || !getProject().getPlugins().hasPlugin(GroovyBasePlugin.class)) {
throw new GradleException("You must apply the groovy plugin before the spotless plugin if you are using the groovy extension.");
GroovySourceSet groovySourceSet = new DslObject(sourceSet).getConvention().getPlugin(GroovySourceSet.class);
if (excludeJava) {
union = union.plus(groovySourceSet.getAllGroovy());
代码示例来源:origin: gradle.plugin.de.otto.shopoffice/otto-classycle-plugin
private JavaPluginConvention getJavaPluginConvention(final Project project) {
final JavaPluginConvention javaPlugin = project.getConvention().getPlugin(JavaPluginConvention.class);
if (javaPlugin == null) {
throw new GradleException("You must apply the java plugin before the classycle plugin.");
}
return javaPlugin;
}
代码示例来源:origin: gradle.plugin.ru.javasaw/javasaw
private String testOutputDirsPath() {
final JavaPluginConvention javaPlugin = project.getConvention().getPlugin(JavaPluginConvention.class);
final SourceSetContainer sourceSets = javaPlugin.getSourceSets();
return sourceSets.stream()
.filter(ss -> "test".equals(ss.getName()))
.peek(sourceSet -> LOGGER.debug("finding output dir for sourceSet " + sourceSet.getName()))
.map(SourceSet::getJava)
.map(SourceDirectorySet::getOutputDir)
.map(outputDir -> outputDir.toPath().toAbsolutePath().toString())
.collect(Collectors.joining(":"));
}
@Override
代码示例来源:origin: gradle.plugin.ru.javasaw/javasaw
private List<String> outputDirsPath() {
final JavaPluginConvention javaPlugin = project.getConvention().getPlugin(JavaPluginConvention.class);
final SourceSetContainer sourceSets = javaPlugin.getSourceSets();
return sourceSets.stream()
.filter(ss -> "main".equals(ss.getName()))
.peek(sourceSet -> LOGGER.debug("finding output dir for sourceSet " + sourceSet.getName()))
.map(SourceSet::getJava)
.map(SourceDirectorySet::getOutputDir)
.map(outputDir -> outputDir.toPath().toAbsolutePath().toString())
.collect(Collectors.toList());
}
@Override
代码示例来源:origin: org.anarres.gradle/gradle-velocity-plugin
@Override
public void apply(final Project project) {
final VelocityPluginExtension extension = project.getExtensions().create("velocity", VelocityPluginExtension.class);
project.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().all(
new Action<SourceSet>() {
@Override
public void execute(SourceSet t) {
apply(project, t, extension);
}
});
}
代码示例来源:origin: org.sonarsource.scanner.gradle/sonarqube-gradle-plugin
private static void configureJdkSourceAndTarget(Project project, Map<String, Object> properties) {
JavaPluginConvention javaPluginConvention = new DslObject(project).getConvention().getPlugin(JavaPluginConvention.class);
properties.put(SONAR_JAVA_SOURCE_PROP, javaPluginConvention.getSourceCompatibility());
properties.put(SONAR_JAVA_TARGET_PROP, javaPluginConvention.getTargetCompatibility());
}
代码示例来源:origin: me.seeber.gradle/gradle-project-config
/**
* Get the library directory
*
* @return Library directory
*/
public File getLibsDir() {
BasePluginConvention baseConvention = this.project.getConvention().getPlugin(BasePluginConvention.class);
File libsDir = Validate.notNull(baseConvention.getLibsDir(), "The libs dir must not be null");
return libsDir;
}
代码示例来源:origin: me.seeber.gradle/gradle-project-config
/**
* Provide the base plugin convention
*
* @param project Project to get convention from
* @return Base plugin convention
*/
@Model
@Hidden
public BasePluginConvention basePluginConvention(Project project) {
return project.getConvention().getPlugin(BasePluginConvention.class);
}
代码示例来源:origin: gradle.plugin.me.seeber.gradle/gradle-project-config
/**
* Provide the Java plugin convention
*
* @param project Project to get convention from
* @return Java plugin convention
*/
@Model
@Hidden
public JavaPluginConvention javaPluginConvention(Project project) {
return project.getConvention().getPlugin(JavaPluginConvention.class);
}
代码示例来源:origin: org.gosu-lang.gosu/gradle-gosu-plugin
private void configureGosuDoc( final Project project ) {
GosuDoc gosuDoc = project.getTasks().create(GOSUDOC_TASK_NAME, GosuDoc.class);
gosuDoc.setDescription("Generates Gosudoc API documentation for the main source code.");
gosuDoc.setGroup(JavaBasePlugin.DOCUMENTATION_GROUP);
JavaPluginConvention convention = project.getConvention().getPlugin(JavaPluginConvention.class);
SourceSet sourceSet = convention.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME);
gosuDoc.setClasspath(sourceSet.getOutput().plus(sourceSet.getCompileClasspath()));
Convention sourceSetConvention = (Convention) InvokerHelper.getProperty(sourceSet, "convention");
GosuSourceSet gosuSourceSet = sourceSetConvention.getPlugin(GosuSourceSet.class);
gosuDoc.setSource((Object) gosuSourceSet.getGosu()); // Gradle 4.0 overloads setSource; must upcast to Object for backwards compatibility
}
代码示例来源:origin: io.github.udaychandra.susel/susel-gradle-plugin
private FileCollection getOutputClassDir(Project project) {
return project.getConvention()
.getPlugin(JavaPluginConvention.class)
.getSourceSets()
.getByName("main")
.getOutput()
.getClassesDirs();
}
代码示例来源:origin: dsyer/spring-boot-thin-launcher
private void configureLibPropertiesTask(PropertiesTask thin, Project project) {
thin.setConfiguration(findRuntimeClasspath(project));
SourceSetContainer sourceSets = project.getConvention()
.getPlugin(JavaPluginConvention.class).getSourceSets();
File resourcesDir = sourceSets.getByName("main").getOutput().getResourcesDir();
thin.setOutput(new File(resourcesDir, "META-INF"));
}
内容来源于网络,如有侵权,请联系作者删除!