org.springframework.boot.gradle.tasks.bundling.BootWar Maven / Gradle / Ivy
/*
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.gradle.tasks.bundling;
import java.util.Collections;
import java.util.Set;
import java.util.concurrent.Callable;
import java.util.function.Function;
import org.gradle.api.Action;
import org.gradle.api.Project;
import org.gradle.api.artifacts.result.ResolvedArtifactResult;
import org.gradle.api.file.CopySpec;
import org.gradle.api.file.FileCollection;
import org.gradle.api.file.FileCopyDetails;
import org.gradle.api.file.FileTreeElement;
import org.gradle.api.internal.file.copy.CopyAction;
import org.gradle.api.provider.Provider;
import org.gradle.api.specs.Spec;
import org.gradle.api.tasks.Classpath;
import org.gradle.api.tasks.Nested;
import org.gradle.api.tasks.Optional;
import org.gradle.api.tasks.bundling.War;
import org.gradle.work.DisableCachingByDefault;
import org.springframework.boot.loader.tools.LoaderImplementation;
/**
* A custom {@link War} task that produces a Spring Boot executable war.
*
* @author Andy Wilkinson
* @author Phillip Webb
* @author Scott Frederick
* @since 2.0.0
*/
@DisableCachingByDefault(because = "Not worth caching")
public abstract class BootWar extends War implements BootArchive {
private static final String LAUNCHER = "org.springframework.boot.loader.launch.WarLauncher";
private static final String CLASSES_DIRECTORY = "WEB-INF/classes/";
private static final String LIB_PROVIDED_DIRECTORY = "WEB-INF/lib-provided/";
private static final String LIB_DIRECTORY = "WEB-INF/lib/";
private static final String LAYERS_INDEX = "WEB-INF/layers.idx";
private static final String CLASSPATH_INDEX = "WEB-INF/classpath.idx";
private final BootArchiveSupport support;
private final LayeredSpec layered;
private final Provider projectName;
private final Provider