diff --git a/documentation/index.html b/documentation/index.html index 277afae..95c4696 100644 --- a/documentation/index.html +++ b/documentation/index.html @@ -265,7 +265,76 @@ dependencies { -
+ Templates are invoked with the --init
parameter and typically used when you are creating
+ a new project and you want Kobalt to generate a few files to get you started. Plug-ins can provide multiple
+ templates and you can invoke as many as you need to get your project started. You can get a list of available
+ templates with the --listTemplates
parameter:
+
+$ kobaltw --listTemplates +Available templates + Plug-in: Kobalt + "java" Generates a simple Java project + "kotlin" Generates a simple Kotlin project + "kobalt-plugin" Generate a sample Kobalt plug-in project+
+ You can then invoke any of these templates with --init
:
+
+$ kobaltw --init kobalt-plugin +Build this project with `./kobaltw assemble`+
+ Kobalt just generated a full project that will create a simple Kobalt plug-in. This plug-in adds + a simple task to Kobalt, so let's build it and test it: +
++$ ./kobaltw assemble +----- kobalt-line-count:compile +----- kobalt-line-count:assemble +Created .\kobaltBuild\libs\kobalt-line-count-0.18.jar +Created .\kobaltBuild\libs\kobalt-line-count-0.18-sources.jar +Created .\kobaltBuild\libs\kobalt-line-count-0.18-javadoc.jar +Wrote .\kobaltBuild\libs\kobalt-line-count-0.18.pom +BUILD SUCCESSFUL (5 seconds)+
+ We can test this plug-in with another useful command line parameter: --pluginJarFiles
. You give this parameter a comma-separated list of jar files, each of which is expected to be a Kobalt plug-in. Let's invoke
+ Kobalt with it and ask for a list of available tasks (some of the output was elided):
+
+$ ./kobaltw --pluginJarFiles kobaltBuild/libs/kobalt-line-count-0.18.jar --tasks +... + ===== kobalt-line-count ===== + dynamicTask Dynamic task + lineCount Count the lines +... ++
+ Kobalt loaded this plug-in and added the tasks that it provides. The parameter
+ --pluginJarFiles
is mostly targeted at Kobalt plug-in developers so you can test
+ your plug-ins on your local file system without having to upload them to a Maven repo. More commonly,
+ you will run templates from plug-ins published in a Maven repository, and for this,
+ you use the --plugins
parameter. For example, let's see what templates the
+ Android Kobalt plug-in offers:
+
+$ ./kobaltw --plugins com.beust:kobalt-android: --listTemplates +Available templates + Plug-in: Kobalt + "java" Generates a simple Java project + "kotlin" Generates a simple Kotlin project + "kobalt-plugin" Generate a sample Kobalt plug-in project + Plug-in: Android + "android-java" Generate a simple Android Java project+
+ We see the same plug-ins we just reviewed and a new one provided by the Android plug-in called
+ "android-java"
. The --plugins
parameter expects a comma-separated list of plug-in
+ id's and it acts as if you had specified these Maven id's in your Build.kt
file.
+ The reason why this parameter is useful is that typically, when you run a template, you don't
+ have a build file yet since you are starting a project from scratch.
+
Kobalt already knows the location of the most popular Maven repos (Maven Central, JCenter, JBoss) but you can add repos with the repos()
directive:
@@ -453,10 +522,17 @@ New versions found:
--init
"java,myProject"
. Each archetype will be invoked in order so they can generate their files."java,myProject"
. Each template will be invoked in order so they can generate their files.--listTemplates
--init
parameter.--log
--resolve
"com.beust:kobalt:0.228"
)--tasks
JavaPlugin
contributes a compiler and a doc generator.
-class JavaBuildGenerator: IInitContributor {+class JavaBuildGenerator: ITemplateContributor {
- This class is declaring that it wants to take part in the --init
process (i.e. it can generate an archetype), discussed below.
+ This class is declaring that it wants to take part in the --init
process (i.e. it can generate a template), discussed below.
@@ -184,16 +184,6 @@ class JavaBuildGenerator: IInitContributor { Plug-ins that know how to generate documentation out of source files should implement this interface.
IInitContributor
IContributor
--init
followed by archetype names separated by commas,
- Kobalt will invoke each of these contributors so they can generate their files.
- Archetypes are useful to create projects from scratch with a minimal number of
- files to get started. For example, the "java" archetype will generate a `Build.kt`
- file suitable for a brand new Java project.
- IProjectContributor
IContributor
ITemplateContributor
IContributor
--init
followed by template names separated by commas,
+ Kobalt will invoke each of these contributors so they can generate their files.
+ Templates are useful to create projects from scratch with a minimal number of
+ files to get started. For example, the "java" template will generate a Build.kt
+ file suitable for a brand new Java project.
+
ITestRunnerContributor