From 0a81f95f4daba33e3955476d1b3dee35729bbda5 Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Thu, 24 Dec 2015 23:02:15 +0400 Subject: [PATCH] Generate .pom if mavenJars{} is invoked --- .../beust/kobalt/plugin/packaging/PackagingPlugin.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 869a8866..22e07c85 100644 --- a/src/main/kotlin/com/beust/kobalt/plugin/packaging/PackagingPlugin.kt +++ b/src/main/kotlin/com/beust/kobalt/plugin/packaging/PackagingPlugin.kt @@ -12,6 +12,7 @@ import com.beust.kobalt.api.annotation.Task import com.beust.kobalt.glob import com.beust.kobalt.internal.JvmCompilerPlugin import com.beust.kobalt.maven.DependencyManager +import com.beust.kobalt.maven.PomGenerator import com.beust.kobalt.misc.* import java.io.File import java.io.FileOutputStream @@ -24,7 +25,8 @@ import javax.inject.Singleton @Singleton class PackagingPlugin @Inject constructor(val dependencyManager : DependencyManager, val executors: KobaltExecutors, val jarGenerator: JarGenerator, val warGenerator: WarGenerator, - val zipGenerator: ZipGenerator, val taskContributor: TaskContributor) + val zipGenerator: ZipGenerator, val taskContributor: TaskContributor, + val pomFactory: PomGenerator.IFactory) : ConfigPlugin(), ITaskContributor { companion object { @@ -180,6 +182,9 @@ class PackagingPlugin @Inject constructor(val dependencyManager : DependencyMana pkg.jars.forEach { jarGenerator.generateJar(pkg.project, context, it) } pkg.wars.forEach { warGenerator.generateWar(pkg.project, context, it, projects) } pkg.zips.forEach { zipGenerator.generateZip(pkg.project, context, it) } + if (pkg.generatePom) { + pomFactory.create(project).generate() + } } return TaskResult() } @@ -228,6 +233,7 @@ class PackageConfig(val project: Project) : AttributeHolder { val jars = arrayListOf() val wars = arrayListOf() val zips = arrayListOf() + var generatePom: Boolean = false init { (Kobalt.findPlugin(PackagingPlugin.PLUGIN_NAME) as PackagingPlugin).addPackage(this) @@ -283,6 +289,8 @@ class PackageConfig(val project: Project) : AttributeHolder { mainJar.addAttribute(it.first, it.second) } + generatePom = true + return m }