org.gradle.api.plugins.jetty.JettyPlugin Maven / Gradle / Ivy
/*
* Copyright 2010 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
*
* http://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.gradle.api.plugins.jetty;
import org.gradle.api.Action;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.plugins.Convention;
import org.gradle.api.plugins.JavaPluginConvention;
import org.gradle.api.plugins.WarPlugin;
import org.gradle.api.plugins.WarPluginConvention;
import org.gradle.api.tasks.SourceSet;
import org.gradle.api.tasks.bundling.War;
import org.gradle.util.DeprecationLogger;
import java.io.File;
import java.util.concurrent.Callable;
/**
* A {@link Plugin} which extends the {@link WarPlugin} to add tasks which run the web application using an embedded
* Jetty web container.
*
* @deprecated The Jetty plugin has been deprecated
*/
@Deprecated
public class JettyPlugin implements Plugin {
public static final String JETTY_RUN = "jettyRun";
public static final String JETTY_RUN_WAR = "jettyRunWar";
public static final String JETTY_STOP = "jettyStop";
public static final String RELOAD_AUTOMATIC = "automatic";
public static final String RELOAD_MANUAL = "manual";
public void apply(Project project) {
DeprecationLogger.nagUserOfPluginReplacedWithExternalOne("Jetty", "Gretty (https://github.com/akhikhl/gretty)");
project.getPluginManager().apply(WarPlugin.class);
JettyPluginConvention jettyConvention = new JettyPluginConvention();
Convention convention = project.getConvention();
convention.getPlugins().put("jetty", jettyConvention);
configureMappingRules(project, jettyConvention);
configureJettyRun(project);
configureJettyRunWar(project);
configureJettyStop(project, jettyConvention);
}
private void configureMappingRules(final Project project, final JettyPluginConvention jettyConvention) {
project.getTasks().withType(AbstractJettyRunTask.class, new Action() {
public void execute(AbstractJettyRunTask abstractJettyRunTask) {
configureAbstractJettyTask(project, jettyConvention, abstractJettyRunTask);
}
});
}
private void configureJettyRunWar(final Project project) {
project.getTasks().withType(JettyRunWar.class, new Action() {
public void execute(JettyRunWar jettyRunWar) {
jettyRunWar.dependsOn(WarPlugin.WAR_TASK_NAME);
jettyRunWar.getConventionMapping().map("webApp", new Callable
© 2015 - 2025 Weber Informatics LLC | Privacy Policy