本文整理汇总了Java中org.gradle.api.plugins.ExtraPropertiesExtension.get方法的典型用法代码示例。如果您正苦于以下问题:Java ExtraPropertiesExtension.get方法的具体用法?Java ExtraPropertiesExtension.get怎么用?Java ExtraPropertiesExtension.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.gradle.api.plugins.ExtraPropertiesExtension
的用法示例。
在下文中一共展示了ExtraPropertiesExtension.get方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getExtraProperty
import org.gradle.api.plugins.ExtraPropertiesExtension; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public static <T> T getExtraProperty(Project project, String name, T value, Class<T> returnType) {
LOGGER.debug("Getting extra property " + name + " from project " + project.getName());
ExtraPropertiesExtension ext = project.getExtensions().getExtraProperties();
if (ext != null && ext.has(name)) {
Object property = ext.get(name);
if (property == null) {
LOGGER.debug("Extra property {} is null.", name);
} else if (!returnType.isInstance(property)) {
LOGGER.warn("Extra property {} is not {}. It's value will be ignored!", name, returnType.getName());
} else {
return (T) property;
}
} else {
LOGGER.debug("Extra property {} is not set.", name);
}
return value;
}
示例2: setMainClass
import org.gradle.api.plugins.ExtraPropertiesExtension; //导入方法依赖的package包/类
private void setMainClass(Repackager repackager) {
String mainClass;
if (getProject().hasProperty("mainClassName")) {
mainClass = (String) getProject().property("mainClassName");
}
else {
ExtraPropertiesExtension extraProperties = (ExtraPropertiesExtension) getProject()
.getExtensions().getByName("ext");
mainClass = (String) extraProperties.get("mainClassName");
}
if (RepackageTask.this.mainClass != null) {
mainClass = RepackageTask.this.mainClass;
}
else if (this.extension.getMainClass() != null) {
mainClass = this.extension.getMainClass();
}
else {
Task runTask = getProject().getTasks().findByName("run");
if (runTask != null && runTask.hasProperty("main")) {
mainClass = (String) getProject().getTasks().getByName("run")
.property("main");
}
}
getLogger().info("Setting mainClass: " + mainClass);
repackager.setMainClass(mainClass);
}
示例3: getOrCreateGlobalAnalysisMap
import org.gradle.api.plugins.ExtraPropertiesExtension; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private Map<File, File> getOrCreateGlobalAnalysisMap() {
ExtraPropertiesExtension extraProperties = getProject().getRootProject().getExtensions().getExtraProperties();
Map<File, File> analysisMap;
if (extraProperties.has("scalaCompileAnalysisMap")) {
analysisMap = (Map) extraProperties.get("scalaCompileAnalysisMap");
} else {
analysisMap = Maps.newHashMap();
for (Project project : getProject().getRootProject().getAllprojects()) {
for (ScalaCompile task : project.getTasks().withType(ScalaCompile.class)) {
if (task.getScalaCompileOptions().isUseAnt()) { continue; }
File publishedCode = task.getScalaCompileOptions().getIncrementalOptions().getPublishedCode();
File analysisFile = task.getScalaCompileOptions().getIncrementalOptions().getAnalysisFile();
analysisMap.put(publishedCode, analysisFile);
}
}
extraProperties.set("scalaCompileAnalysisMap", Collections.unmodifiableMap(analysisMap));
}
return analysisMap;
}
示例4: getMainClassNameProperty
import org.gradle.api.plugins.ExtraPropertiesExtension; //导入方法依赖的package包/类
private String getMainClassNameProperty() {
if (getProject().hasProperty("mainClassName")) {
return (String) getProject().property("mainClassName");
}
ExtraPropertiesExtension extraProperties = (ExtraPropertiesExtension) getProject()
.getExtensions().getByName("ext");
if (extraProperties.has("mainClassName")) {
return (String) extraProperties.get("mainClassName");
}
return null;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:12,代码来源:RepackageTask.java
示例5: getMainClassNameProperty
import org.gradle.api.plugins.ExtraPropertiesExtension; //导入方法依赖的package包/类
private String getMainClassNameProperty() {
if (getProject().hasProperty("mainClassName")) {
return (String) getProject().property("mainClassName");
}
ExtraPropertiesExtension extraProperties = (ExtraPropertiesExtension) getProject()
.getExtensions().getByName("ext");
return (String) extraProperties.get("mainClassName");
}
示例6: getExtraPropertyValue
import org.gradle.api.plugins.ExtraPropertiesExtension; //导入方法依赖的package包/类
/**
* Read the value of an extra property of the project.
*
* @param pExtraPropName the reference to the extra property name
* @param <T> type of the property value
* @return the property's value
*/
@SuppressWarnings("unchecked")
public <T> T getExtraPropertyValue(@Nonnull final ExtProp pExtraPropName)
{
ExtraPropertiesExtension extraProps = project.getExtensions().getByType(ExtraPropertiesExtension.class);
if (extraProps.has(pExtraPropName.getPropertyName())) {
return (T) extraProps.get(pExtraPropName.getPropertyName());
}
throw new GradleException(
"Reference to non-existent project extra property '" + pExtraPropName.getPropertyName() + "'");
}
示例7: getExtraPropertyOrNull
import org.gradle.api.plugins.ExtraPropertiesExtension; //导入方法依赖的package包/类
public static <T> T getExtraPropertyOrNull(@Nonnull Project project, @Nonnull String name) {
ExtraPropertiesExtension properties = project.getExtensions().getExtraProperties();
if (properties.has(name))
return (T) properties.get(name);
return null;
}