本文整理了Java中org.gradle.api.tasks.bundling.War
类的一些代码示例,展示了War
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。War
类的具体详情如下:
包路径:org.gradle.api.tasks.bundling.War
类名称:War
暂无
代码示例来源:origin: gradle.plugin.fish.payara.gradle.plugins/payara-micro-gradle-plugin
protected File getWar() {
return ((War) project.getTasks().getByName(WarPlugin.WAR_TASK_NAME)).getArchivePath();
}
代码示例来源:origin: gradle.plugin.com.liferay/gradle-plugins-theme-builder
final BuildThemeTask buildThemeTask) {
war.dependsOn(buildThemeTask);
war.eachFile(
new Action<FileCopyDetails>() {
war.exclude(
new Spec<FileTreeElement>() {
war.exclude("**/*.scss");
war.from(
new Callable<File>() {
war.setIncludeEmptyDirs(false);
代码示例来源:origin: steffenschaefer/gwt-gradle-plugin
public FileCollection call() throws Exception {
return warTask.getClasspath();
}
}});
代码示例来源:origin: steffenschaefer/gwt-gradle-plugin
@Override
public void execute(Project t) {
String modulePathPrefix = extension.getModulePathPrefix();
if(modulePathPrefix == null || modulePathPrefix.isEmpty()) {
warTask.from(compileTask.getOutputs());
return;
}
warTask.into(modulePathPrefix == null ? "" : modulePathPrefix, (new ActionClosure<CopySpec>(this, new Action<CopySpec>(){
@Override
public void execute(CopySpec spec) {
spec.from(compileTask.getOutputs());
spec.exclude("WEB-INF");
}})));
warTask.into("", (new ActionClosure<CopySpec>(this, new Action<CopySpec>(){
@Override
public void execute(CopySpec spec) {
spec.from(compileTask.getOutputs());
spec.include("WEB-INF");
}})));
}});
代码示例来源:origin: io.freefair.gradle/jsass-gradle-plugin
@Override
public void apply(Project project) {
jSassBasePlugin = project.getPlugins().apply(JSassBasePlugin.class);
project.getPlugins().apply(WarPlugin.class);
SassCompile compileWebappSass = project.getTasks().create("compileWebappSass", SassCompile.class);
compileWebappSass.setGroup(BasePlugin.BUILD_GROUP);
compileWebappSass.setDescription("Compile sass and scss files for the webapp");
WarPluginConvention warPluginConvention = project.getConvention().getPlugin(WarPluginConvention.class);
compileWebappSass.setSourceDir(warPluginConvention.getWebAppDir());
project.afterEvaluate(p -> {
War war = (War) p.getTasks().getByName(WarPlugin.WAR_TASK_NAME);
if (jSassBasePlugin.getExtension().isInplace()) {
compileWebappSass.setDestinationDir(warPluginConvention.getWebAppDir());
war.dependsOn(compileWebappSass);
} else {
compileWebappSass.setDestinationDir(new File(p.getBuildDir(), "jsass/webapp"));
war.from(compileWebappSass);
}
});
}
}
代码示例来源:origin: Putnami/putnami-gradle-plugin
@Override
public void execute(final GwtCompileTask task) {
task.configure(project, extension);
warTask.from(extension.getCompile().getWar());
}
});
代码示例来源:origin: steffenschaefer/gwt-gradle-plugin
draftWar.from(draftCompileTask.getOutputs());
draftWar.setAppendix("draft");
draftWar.setDescription("Creates a war using the output of the task "
+ GwtCompilerPlugin.TASK_DRAFT_COMPILE_GWT);
代码示例来源:origin: gradle.plugin.de.esoco.gwt/gwt-gradle-plugin
private void createCompileTask(final Project project) {
project.getTasks().create(GwtCompileTask.NAME, GwtCompileTask.class);
final GwtExtension extension = project.getExtensions().getByType(GwtExtension.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());
}
});
}
代码示例来源:origin: io.freefair.gradle/war-plugin
@Override
public void apply(Project project) {
project.getTasks().withType(War.class, war -> {
WarArchiveClassesConvention archiveClassesConvention = new WarArchiveClassesConvention();
war.getConvention().getPlugins().put("archiveClasses", archiveClassesConvention);
Jar warClassesJar = project.getTasks().create(war.getName() + "ClassesJar", Jar.class);
warClassesJar.getConventionMapping().map("baseName", war::getBaseName);
warClassesJar.getConventionMapping().map("appendix", war::getAppendix);
warClassesJar.getConventionMapping().map("version", war::getVersion);
warClassesJar.getConventionMapping().map("classifier", war::getClassifier);
project.afterEvaluate(p -> {
warClassesJar.setEnabled(archiveClassesConvention.isArchiveClasses());
if (archiveClassesConvention.isArchiveClasses()) {
FileCollection warClasspath = war.getClasspath();
warClassesJar.from(warClasspath != null ? warClasspath.filter(File::isDirectory) : Collections.emptyList());
war.setClasspath(warClasspath == null ? null : warClasspath.filter(File::isFile).plus(project.files(warClassesJar)));
}
});
});
}
}
代码示例来源:origin: io.freefair.gradle/war-plugin
private void configureOverlay(WarOverlay overlay) {
if (overlay.isDeferProvidedConfiguration()) {
//Delay this to trick IntelliJ
overlay.getWarTask().doFirst(w -> overlay.getWarCopySpec().exclude(element -> overlay.isProvided()));
} else {
overlay.getWarCopySpec().exclude(element -> overlay.isProvided());
}
Object source = overlay.getSource();
if (source instanceof AbstractArchiveTask) {
configureOverlay(overlay, (AbstractArchiveTask) source);
} else if (source instanceof Project && overlay.getConfigureClosure() == null) {
configureOverlay(overlay, (Project) source);
} else {
Closure configClosure = overlay.getConfigureClosure();
Dependency dependency;
if (configClosure == null) {
dependency = project.getDependencies().create(source);
} else {
dependency = project.getDependencies().create(source, configClosure);
}
if (dependency instanceof ProjectDependency) {
configureOverlay(overlay, ((ProjectDependency) dependency).getDependencyProject());
} else if (dependency instanceof ExternalDependency) {
configureOverlay(overlay, (ExternalDependency) dependency);
} else {
throw new GradleException("Unsupported dependency type: " + dependency.getClass().getName());
}
}
}
代码示例来源:origin: gradle.plugin.de.esoco.gwt/gwt-gradle-plugin
@Override
public void execute(final GwtCompileTask task) {
task.configure(project, extension);
warTask.from(extension.getCompile().getWar());
}
});
代码示例来源:origin: Putnami/putnami-gradle-plugin
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);
}
代码示例来源:origin: Putnami/putnami-gradle-plugin
@TaskAction
public void exec() throws Exception {
War warTask = (War) getProject().getTasks().getByName("war");
jettyConf = new File(getProject().getBuildDir(), "putnami/conf/jetty-run-conf.xml");
Map<String, String> model = new ImmutableMap.Builder<String, String>()
.put("__WAR_FILE__", warTask.getArchivePath().getAbsolutePath())
.build();
ResourceUtils.copy("/stub.jetty-conf.xml", jettyConf, model);
JavaAction jetty = execJetty();
jetty.join();
}
代码示例来源:origin: io.freefair.gradle/jsass-plugin
@Override
public void apply(Project project) {
project.getPlugins().apply(JSassWebjarsPlugin.class);
project.getPlugins().apply(WarPlugin.class);
TaskProvider<SassCompile> sassCompileTaskProvider = project.getTasks().register("compileWebappSass", SassCompile.class, compileWebappSass -> {
compileWebappSass.setGroup(BasePlugin.BUILD_GROUP);
compileWebappSass.setDescription("Compile sass and scss files for the webapp");
WarPluginConvention warPluginConvention = project.getConvention().getPlugin(WarPluginConvention.class);
compileWebappSass.source(warPluginConvention.getWebAppDir());
compileWebappSass.getDestinationDir().set(new File(project.getBuildDir(), "jsass/webapp"));
});
project.getTasks().named(WarPlugin.WAR_TASK_NAME, War.class)
.configure(war -> war.from(sassCompileTaskProvider));
}
}
代码示例来源:origin: gradle.plugin.de.esoco.gwt/gwt-gradle-plugin
@TaskAction
public void exec() throws Exception {
War warTask = (War) getProject().getTasks().getByName("war");
jettyConf = new File(getProject().getBuildDir(), "gwt/conf/jetty-run-conf.xml");
Map<String, String> model = new ImmutableMap.Builder<String, String>()
.put("__WAR_FILE__", warTask.getArchivePath().getAbsolutePath())
.build();
ResourceUtils.copy("/stub.jetty-conf.xml", jettyConf, model);
JavaAction jetty = execJetty();
jetty.join();
}
代码示例来源:origin: GoogleCloudPlatform/app-gradle-plugin
private void createExplodedWarTask() {
project
.getTasks()
.create(
EXPLODE_WAR_TASK_NAME,
ExplodeWarTask.class,
explodeWar -> {
explodeWar.setExplodedAppDirectory(explodedWarDir);
explodeWar.dependsOn(WarPlugin.WAR_TASK_NAME);
explodeWar.setGroup(APP_ENGINE_STANDARD_TASK_GROUP);
explodeWar.setDescription("Explode a war into a directory");
project.afterEvaluate(
project ->
explodeWar.setWarFile(
((War) project.getTasks().getByPath(WarPlugin.WAR_TASK_NAME))
.getArchivePath()));
});
project.getTasks().getByName(BasePlugin.ASSEMBLE_TASK_NAME).dependsOn(EXPLODE_WAR_TASK_NAME);
}
代码示例来源:origin: com.google.cloud.tools/appengine-gradle-plugin
@Override
public void execute(Project project) {
// we can only set the default location of "archive" after project evaluation (callback)
if (stageExtension.getArtifact() == null) {
if (project.getPlugins().hasPlugin(WarPlugin.class)) {
War war = (War) project.getProperties().get("war");
stageExtension.setArtifact(war.getArchivePath());
} else if (project.getPlugins().hasPlugin(JavaPlugin.class)) {
Jar jar = (Jar) project.getProperties().get("jar");
stageExtension.setArtifact(jar.getArchivePath());
} else {
throw new GradleException("Could not find JAR or WAR configuration");
}
}
}
});
代码示例来源:origin: gradle.plugin.com.google.cloud.tools/jib-gradle-plugin
.create(EXPLODED_WAR_TASK_NAME, ExplodedWarTask.class)
.dependsOn(warTask);
explodedWarTask.setWarFile(warTask.getArchivePath().toPath());
explodedWarTask.setExplodedWarDirectory(
GradleProjectProperties.getExplodedWarDirectory(projectAfterEvaluation));
代码示例来源:origin: GoogleCloudPlatform/app-gradle-plugin
if (project.getPlugins().hasPlugin(WarPlugin.class)) {
War war = (War) project.getProperties().get("war");
stageExtension.setArtifact(war.getArchivePath());
} else if (project.getPlugins().hasPlugin(JavaPlugin.class)) {
Jar jar = (Jar) project.getProperties().get("jar");
代码示例来源:origin: GoogleCloudPlatform/app-gradle-plugin
@Test
public void testDefaultConfiguration() throws IOException {
Project p = new TestProject(testProjectDir.getRoot()).applyAppYamlWarProjectBuilder();
AppEngineAppYamlExtension ext = p.getExtensions().getByType(AppEngineAppYamlExtension.class);
DeployExtension deployExt = ext.getDeploy();
StageAppYamlExtension stageExt = ext.getStage();
assertEquals(new File(p.getBuildDir(), "staged-app"), stageExt.getStagingDirectory());
assertEquals(
testProjectDir.getRoot().toPath().toRealPath().resolve("src/main/appengine"),
stageExt.getAppEngineDirectory().toPath());
assertEquals(
testProjectDir.getRoot().toPath().toRealPath().resolve("src/main/appengine"),
deployExt.getAppEngineDirectory().toPath());
assertEquals((((War) p.getProperties().get("war")).getArchivePath()), stageExt.getArtifact());
assertFalse(new File(testProjectDir.getRoot(), "src/main/docker").exists());
assertEquals("test-project", deployExt.getProjectId());
assertEquals("test-version", deployExt.getVersion());
}
内容来源于网络,如有侵权,请联系作者删除!