diff --git a/src/main/kotlin/com/beust/kobalt/plugin/packaging/JarGenerator.kt b/src/main/kotlin/com/beust/kobalt/plugin/packaging/JarGenerator.kt index b3c5d77f..0af5bc47 100644 --- a/src/main/kotlin/com/beust/kobalt/plugin/packaging/JarGenerator.kt +++ b/src/main/kotlin/com/beust/kobalt/plugin/packaging/JarGenerator.kt @@ -31,7 +31,9 @@ class JarGenerator @Inject constructor(val dependencyManager: DependencyManager) // Class files val files = KFiles.findRecursively(classesDir).map { File(relClassesDir.toFile(), it) } - val filesNotExcluded : List = files.filter { ! KFiles.isExcluded(it, jar.excludes) } + val filesNotExcluded : List = files.filter { + ! KFiles.isExcluded(KFiles.joinDir(project.directory, it.path), jar.excludes) + } val fileSpecs = arrayListOf() filesNotExcluded.forEach { fileSpecs.add(IFileSpec.FileSpec(it.path.toString().substring(prefixPath.toString().length + 1))) diff --git a/src/main/kotlin/com/beust/kobalt/plugin/packaging/PackagingPlugin.kt b/src/main/kotlin/com/beust/kobalt/plugin/packaging/PackagingPlugin.kt index db1c7e30..07b000c4 100644 --- a/src/main/kotlin/com/beust/kobalt/plugin/packaging/PackagingPlugin.kt +++ b/src/main/kotlin/com/beust/kobalt/plugin/packaging/PackagingPlugin.kt @@ -52,13 +52,12 @@ class PackagingPlugin @Inject constructor(val dependencyManager : DependencyMana val fromPath = directory + "/" + includedFile.from if (File(fromPath).exists()) { spec.toFiles(fromPath).forEach { file -> - File(fromPath, file.path).let { - if (!it.exists()) { - throw AssertionError("File should exist: $it") - } + val fullFile = File(fromPath, file.path) + if (! fullFile.exists()) { + throw AssertionError("File should exist: $fullFile") } - if (!KFiles.isExcluded(file, excludes)) { + if (!KFiles.isExcluded(fullFile, excludes)) { includedSpecs.add(FileSpec(file.path)) } else { log(2, "Not adding ${file.path} to jar file because it's excluded")