本文整理了Java中org.gradle.api.Project.getProject()
方法的一些代码示例,展示了Project.getProject()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Project.getProject()
方法的具体详情如下:
包路径:org.gradle.api.Project
类名称:Project
方法名:getProject
暂无
代码示例来源:origin: com.github.oehme.sobula/sobula
PluginContainer _plugins = it.getPlugins();
_plugins.<BaseContactsPlugin>apply(BaseContactsPlugin.class);
Project _project = it.getProject();
ExtensionContainer _extensions = _project.getExtensions();
final ContactsExtension contacts = _extensions.<ContactsExtension>getByType(ContactsExtension.class);
代码示例来源:origin: zeroturnaround/gradle-jrebel-plugin
/**
* Test that the plugin adds a dummy task to the project when no JavaPlugin is applied
*/
@Test
public void testAddsDummyTaskWhenJavaPluginNotApplied() {
ex.expectCause(CoreMatchers.<Throwable>instanceOf(IllegalStateException.class));
ex.expectCause(hasMessage(containsString("generateRebel is only valid when JavaPlugin is applied")));
Project project = ProjectBuilder.builder().build();
project.getProject().getPlugins().apply(RebelPlugin.class);
Task task = project.getTasks().getByName(RebelPlugin.GENERATE_REBEL_TASK_NAME);
assertTrue(task instanceof DefaultTask);
((DefaultTask) task).execute();
cleanUp(project);
}
代码示例来源:origin: zeroturnaround/gradle-jrebel-plugin
/**
* Test that the plugin adds RebelGenerateTask to project when JavaPlugin is already applied
*/
@Test
public void testAddsRebelTaskWhenJavaPluginApplied() {
Project project = ProjectBuilder.builder().build();
project.getProject().getPlugins().apply(JavaPlugin.class);
project.getProject().getPlugins().apply(RebelPlugin.class);
Task genRebelTask = getTask(project, RebelPlugin.GENERATE_REBEL_TASK_NAME);
assertTrue(genRebelTask instanceof RebelGenerateTask);
RebelGenerateTask rebelTask = (RebelGenerateTask) genRebelTask;
assertTrue(rebelTask.getPackaging().equals(RebelGenerateTask.PACKAGING_TYPE_JAR));
// check that the dependsOn is set properly
assertFalse(genRebelTask.getDependsOn().contains(getTask(project, CLASSES_TASK_NAME)));
assertTrue(getTask(project, PROCESS_RESOURCES_TASK_NAME).getDependsOn().contains(genRebelTask));
cleanUp(project);
}
代码示例来源:origin: zeroturnaround/gradle-jrebel-plugin
/**
* Test that the plugin adds rebel task to project after GroovyPlugin is applied
*/
@Test
public void testAddsRebelTaskAfterGroovyPluginApplied() {
Project project = ProjectBuilder.builder().build();
project.getProject().getPlugins().apply(RebelPlugin.class);
project.getProject().getPlugins().apply(GroovyPlugin.class);
Task genRebelTask = getTask(project, RebelPlugin.GENERATE_REBEL_TASK_NAME);
assertTrue(genRebelTask instanceof RebelGenerateTask);
RebelGenerateTask rebelTask = (RebelGenerateTask) genRebelTask;
assertTrue(rebelTask.getPackaging().equals(RebelGenerateTask.PACKAGING_TYPE_JAR));
// check that the dependsOn is set properly
assertFalse(genRebelTask.getDependsOn().contains(getTask(project, CLASSES_TASK_NAME)));
assertTrue(getTask(project, PROCESS_RESOURCES_TASK_NAME).getDependsOn().contains(genRebelTask));
cleanUp(project);
}
代码示例来源:origin: zeroturnaround/gradle-jrebel-plugin
/**
* Test that the plugin uses war packaging mode after JettyPlugin gets applied
*/
@Test
public void testUsesWarPackagingWithJettyPlugin() {
Project project = ProjectBuilder.builder().build();
project.getProject().getPlugins().apply(RebelPlugin.class);
project.getProject().getPlugins().apply(WarPlugin.class);
Task genRebelTask = getTask(project, RebelPlugin.GENERATE_REBEL_TASK_NAME);
assertTrue(genRebelTask instanceof RebelGenerateTask);
RebelGenerateTask rebelTask = (RebelGenerateTask) genRebelTask;
assertTrue(rebelTask.getPackaging().equals(RebelGenerateTask.PACKAGING_TYPE_WAR));
// check that the dependsOn is set properly
assertFalse(genRebelTask.getDependsOn().contains(getTask(project, CLASSES_TASK_NAME)));
assertTrue(getTask(project, PROCESS_RESOURCES_TASK_NAME).getDependsOn().contains(genRebelTask));
cleanUp(project);
}
代码示例来源:origin: zeroturnaround/gradle-jrebel-plugin
/**
* Test that the plugin uses war packaging mode when WarPlugin is already applied
*/
@Test
public void testUsesWarPackagingWithWarPlugin() {
Project project = ProjectBuilder.builder().build();
project.getProject().getPlugins().apply(WarPlugin.class);
project.getProject().getPlugins().apply(RebelPlugin.class);
Task genRebelTask = getTask(project, RebelPlugin.GENERATE_REBEL_TASK_NAME);
assertTrue(genRebelTask instanceof RebelGenerateTask);
RebelGenerateTask rebelTask = (RebelGenerateTask) genRebelTask;
assertTrue(rebelTask.getPackaging().equals(RebelGenerateTask.PACKAGING_TYPE_WAR));
// check that the dependsOn is set properly
assertFalse(genRebelTask.getDependsOn().contains(getTask(project, CLASSES_TASK_NAME)));
assertTrue(getTask(project, PROCESS_RESOURCES_TASK_NAME).getDependsOn().contains(genRebelTask));
cleanUp(project);
}
内容来源于网络,如有侵权,请联系作者删除!