diff --git a/src/main/kotlin/com/beust/kobalt/maven/DepFactory.kt b/src/main/kotlin/com/beust/kobalt/maven/DepFactory.kt index b26897e8..c218f9ae 100644 --- a/src/main/kotlin/com/beust/kobalt/maven/DepFactory.kt +++ b/src/main/kotlin/com/beust/kobalt/maven/DepFactory.kt @@ -18,8 +18,9 @@ public class DepFactory @Inject constructor(val localRepo: LocalRepo, val pomFactory: Pom.IFactory) { companion object { - val defExecutor = - Kobalt.INJECTOR.getInstance(Key.get(ExecutorService::class.java, DependencyExecutor::class.java)) + val defExecutor : ExecutorService by lazy { + Kobalt.INJECTOR.getInstance(Key.get(ExecutorService::class.java, DependencyExecutor::class.java)) + } } /** diff --git a/src/test/kotlin/com/beust/kobalt/maven/PomTest.kt b/src/test/kotlin/com/beust/kobalt/maven/PomTest.kt index 0484d4fb..ef8d6fc4 100644 --- a/src/test/kotlin/com/beust/kobalt/maven/PomTest.kt +++ b/src/test/kotlin/com/beust/kobalt/maven/PomTest.kt @@ -2,6 +2,7 @@ package com.beust.kobalt.maven import com.beust.kobalt.Args import com.beust.kobalt.KobaltTest +import com.beust.kobalt.api.Kobalt import com.beust.kobalt.app.ProjectGenerator import com.beust.kobalt.internal.PluginInfo import com.google.inject.Inject @@ -9,7 +10,7 @@ import org.testng.Assert import org.testng.annotations.Test import java.io.File -class PomTest @Inject constructor(val pluginInfo: PluginInfo) : KobaltTest() { +class PomTest @Inject constructor() : KobaltTest() { @Test fun importPom() { val pomSrc = File("src/test/resources/pom.xml") @@ -55,7 +56,9 @@ class PomTest @Inject constructor(val pluginInfo: PluginInfo) : KobaltTest() { val args = Args() args.buildFile = file.absolutePath args.init = true - ProjectGenerator(pluginInfo).run(args) + + ProjectGenerator(Kobalt.INJECTOR.getInstance(PluginInfo::class.java)).run(args) + var contents = file.readText() Assert.assertTrue(contents.contains("group = \"${pom.groupId}\""), "Should find the group defined") Assert.assertTrue(contents.contains("name = \"${pom.name}\""), "Should find the name defined")