From e5289f0bace6e63df506401ba1eab2bb36c6476e Mon Sep 17 00:00:00 2001
From: Cedric Beust
+ The simplest way to run your plug-in in your IDE is to create a main function in the main class of your + plug-in as follows: +
++fun main(argv: Array<String>) { + com.beust.kobalt.main(argv) +} ++
+ In order for this code to compile, you will have to switch the dependency of your plug-in from
+ kobalt-plugin-api
to just kobalt
, which is the actual application (and which
+ therefore contains the main()
entry point).
+
+ // Normal dependency + compile("com.beust:kobalt-plugin-api:$KOBALT_VERSION") + // Development dependency + compile("com.beust:kobalt:$KOBALT_VERSION") ++
+ You might find it convenient to leverage Kobalt's ability to use regular Kotlin variables to make things easier: +
++val dev = false +val kobaltDependency = if (dev) "kobalt" else "kobalt-plugin-api" + +val p = project { + // ... + + compile("com.beust:$kobaltDependency:$KOBALT_VERSION") +} ++
+ Then you can simply set the dev
to true
during development and back to false
+
when you are ready to publish your plug-in.
+
+
+ Then resync your build file in IDEA and your main()
function should now build and be launchable.
+ You can right click on that class file and select "Debug <your class name>", which will launch Kobalt
+ with your plug-in. You can set a breakpoint in one of your tasks or anywhere that gets invoked. Don't forget
+ to invoke this launch configuration with the regular parameters passed to Kobalt (e.g. "assemble"
).
+