io.openliberty.tools.gradle.tasks.UndeployTask.groovy Maven / Gradle / Ivy
The newest version!
/**
* (C) Copyright IBM Corporation 2014, 2024.
*
* 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 io.openliberty.tools.gradle.tasks
import org.gradle.api.GradleException
import org.gradle.api.Task
import org.gradle.api.tasks.TaskAction
import io.openliberty.tools.ant.ServerTask
import io.openliberty.tools.gradle.utils.CommonLogger
class UndeployTask extends AbstractServerTask {
private static final String STOP_APP_MESSAGE_CODE_REG = "CWWKZ0009I.*"
private static final long APP_STOP_TIMEOUT_DEFAULT = 30 * 1000
protected List appFiles = new ArrayList()
UndeployTask() {
configure({
description 'Removes an application from the Liberty server.'
group 'Liberty'
})
}
@TaskAction
void undeploy() {
if (server.undeploy != null) {
if (server.undeploy.apps != null && !server.undeploy.apps.isEmpty()) {
def apps = getAppFiles(server.undeploy.apps, 'apps')
apps.each { undeployApp(it, 'apps') }
}
if (server.undeploy.dropins != null && !server.undeploy.dropins.isEmpty()) {
def dropins = getAppFiles(server.undeploy.dropins, 'dropins')
dropins.each { undeployApp(it, 'dropins') }
}
}
}
private void getAppFiles(List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy