
com.google.appengine.task.ExplodeAppTask.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gradle-appengine-plugin Show documentation
Show all versions of gradle-appengine-plugin Show documentation
Gradle plugin that provides tasks for uploading, running and managing Google App Engine projects.
/*
* Copyright 2011 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 com.google.appengine.task
import org.gradle.api.DefaultTask
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.TaskAction
import java.nio.file.Files
/**
* Google App Engine task that explodes the WAR archive into a given directory.
*
* @author Benjamin Muschko
*/
class ExplodeAppTask extends DefaultTask implements Explodable {
@InputFile File archive
@OutputDirectory File explodedAppDirectory
@TaskAction
protected void start() {
ant.delete(dir: getExplodedAppDirectory())
ant.unzip(src: getArchive(), dest: getExplodedAppDirectory())
if(getArchive().name.endsWith(".ear")) {
for(File war : getExplodedAppDirectory().listFiles(new FilenameFilter() {
@Override
boolean accept(File dir, String name) {
name.endsWith(".war")
}
})) {
File warDestination = new File(war.canonicalPath.substring(0, war.canonicalPath.length() - 4))
Files.createDirectory(warDestination.toPath())
ant.unzip(src: war, dest: warDestination)
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy