From ce4bbbe27ad668b5b57e3e6dd94d9733608ca107 Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Mon, 15 Feb 2016 11:30:49 -0800 Subject: [PATCH] Clean up a few paths. --- .../beust/kobalt/plugin/packaging/WarGenerator.kt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/com/beust/kobalt/plugin/packaging/WarGenerator.kt b/src/main/kotlin/com/beust/kobalt/plugin/packaging/WarGenerator.kt index 3bffc9a4..428dfe3e 100644 --- a/src/main/kotlin/com/beust/kobalt/plugin/packaging/WarGenerator.kt +++ b/src/main/kotlin/com/beust/kobalt/plugin/packaging/WarGenerator.kt @@ -18,13 +18,19 @@ import java.util.jar.JarOutputStream class WarGenerator @Inject constructor(val dependencyManager: DependencyManager){ + companion object { + val WEB_INF = "WEB-INF" + val CLASSES = "$WEB_INF/classes" + val LIB = "$WEB_INF/lib" + } + fun findIncludedFiles(project: Project, context: KobaltContext, war: War) : List { // // src/main/web app and classes // val result = arrayListOf( IncludedFile(From("src/main/webapp"), To(""), listOf(IFileSpec.GlobSpec("**"))), - IncludedFile(From("kobaltBuild/classes"), To("WEB-INF/classes"), listOf(IFileSpec.GlobSpec("**"))) + IncludedFile(From("kobaltBuild/classes"), To(CLASSES), listOf(IFileSpec.GlobSpec("**"))) ) // @@ -35,9 +41,8 @@ class WarGenerator @Inject constructor(val dependencyManager: DependencyManager) val allDependencies = dependencyManager.calculateDependencies(project, context, dependentProjects, project.compileDependencies) - val WEB_INF = "WEB-INF/lib" val outDir = project.buildDirectory + "/war" - val fullDir = outDir + "/" + WEB_INF + val fullDir = outDir + "/" + LIB File(fullDir).mkdirs() // Run through all the classpath contributors and add their contributions to the libs/ directory @@ -62,7 +67,7 @@ class WarGenerator @Inject constructor(val dependencyManager: DependencyManager) result.add(IncludedFile(From(it.path), To(""), listOf(IFileSpec.GlobSpec("**")))) } - result.add(IncludedFile(From(fullDir), To(WEB_INF), listOf(IFileSpec.GlobSpec("**")))) + result.add(IncludedFile(From(fullDir), To(LIB), listOf(IFileSpec.GlobSpec("**")))) // // Finally, all the included/excluded files specified in the war{} directive