本文整理汇总了Java中org.gradle.api.artifacts.UnknownConfigurationException类的典型用法代码示例。如果您正苦于以下问题:Java UnknownConfigurationException类的具体用法?Java UnknownConfigurationException怎么用?Java UnknownConfigurationException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UnknownConfigurationException类属于org.gradle.api.artifacts包,在下文中一共展示了UnknownConfigurationException类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createXdepsDependencyConfiguration
import org.gradle.api.artifacts.UnknownConfigurationException; //导入依赖的package包/类
public static void createXdepsDependencyConfiguration(Project project) {
Configuration xdeps;
try {
xdeps = project.getConfigurations().getByName("xdeps");
} catch (UnknownConfigurationException e) {
xdeps = project.getConfigurations().create("xdeps");
}
// https://docs.gradle.org/current/userguide/dependency_management.html#sub:dynamic_versions_and_changing_modules
xdeps.getResolutionStrategy().cacheChangingModulesFor(0, TimeUnit.SECONDS);
}
示例2: createNotFoundException
import org.gradle.api.artifacts.UnknownConfigurationException; //导入依赖的package包/类
@Override
protected UnknownDomainObjectException createNotFoundException(String name) {
return new UnknownConfigurationException(String.format("Configuration with name '%s' not found.", name));
}
示例3: fixConfig
import org.gradle.api.artifacts.UnknownConfigurationException; //导入依赖的package包/类
private void fixConfig() {
final Project project = getProject();
// defaults
if (classpath == null) {
try {
classpath.add(project.getConfigurations().getByName(TomEEEmbeddedExtension.ALIAS).fileCollection());
} catch (final UnknownConfigurationException uce) {
classpath = project.getConfigurations().getByName(TomEEEmbeddedExtension.NAME);
}
}
if (docBase == null) {
docBase = new File(project.getProjectDir(), "src/main/webapp");
}
if (workDir == null) {
workDir = new File(project.getBuildDir(), "tomee-embedded/work");
}
if (dir == null) {
dir = new File(project.getBuildDir(), "tomee-embedded/run").getAbsolutePath();
}
if (modules == null || modules.isEmpty()) {
final File main = new File(project.getBuildDir(), "classes/main");
if (main.isDirectory()) {
modules = new ArrayList<>(singletonList(main));
}
}
// extension override
for (final String name : asList(TomEEEmbeddedExtension.NAME, TomEEEmbeddedExtension.ALIAS)) {
final TomEEEmbeddedExtension extension = TomEEEmbeddedExtension.class.cast(project.getExtensions().findByName(name));
if (extension != null) {
for (final Field f : TomEEEmbeddedTask.class.getDeclaredFields()) {
if (f.isAnnotationPresent(Input.class)) {
try {
final Field extField = TomEEEmbeddedExtension.class.getDeclaredField(f.getName());
if (!extField.isAccessible()) {
extField.setAccessible(true);
}
final Object val = extField.get(extension);
if (val != null) {
if (!f.isAccessible()) {
f.setAccessible(true);
}
f.set(this, val);
}
} catch (final IllegalAccessException | NoSuchFieldException e) {
getLogger().warn("No field " + f.getName() + " in " + extension, e);
}
}
}
}
}
}
示例4: getByName
import org.gradle.api.artifacts.UnknownConfigurationException; //导入依赖的package包/类
ConfigurationInternal getByName(String name) throws UnknownConfigurationException;