Download the zip file then unzip it in a location we'll call KOBALT_HOME
:
cd $KOBALT_HOME unzip kobalt-xxx.zip
Change to your project directory and call the kobaltw
command with --init
:
cd ~/java/project $KOBALT_HOME/kobaltw --init
This command will do two things:
kobalt/src/Build.kt
file based on what was found there.
kobalt/
directory. From now on, you can just use ./kobaltw
to build and you can ignore $KOBALT_HOME
.
You can now attempt to build your project with Kobalt:
./kobaltw assembleIf your project follows a regular build structure (e.g. Maven's hierarchy), this should compile your file and create a .jar file. If not, you will have to make a few edits to your
Build.kt
.
As of this writing, Kobalt supports Java and Kotlin projects.
import com.beust.kobalt.* import com.beust.kobalt.plugin.packaging.assemble import com.beust.kobalt.plugin.kotlin.* val kotlin_version = "1.0.0-beta-4583" val p = kotlinProject { name = "wasabi" group = "com.example" artifactId = name version = "0.1" //tells Kobalt to also search here for dependencies val repos = repos("http://oss.sonatype.org/content/repositories/snapshots") dependencies { compile("org.jetbrains.kotlin:kotlin-stdlib:" + kotlin_version) compile("org.jetbrains.kotlin:kotlin-reflect:" + kotlin_version) compile("com.fasterxml.jackson.core:jackson-core:2.6.4") compile("com.fasterxml.jackson.core:jackson-databind:2.6.4") compile("com.fasterxml.jackson.core:jackson-annotations:2.6.4") compile("com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.6.3") compile("com.fasterxml.woodstox:woodstox-core:5.0.1") compile("io.netty:netty-all:4.0.31.Final") compile("commons-codec:commons-codec:1.6") compile("commons-logging:commons-logging:1.1.1") compile("com.netflix.rxjava:rxjava-core:0.20.0-RC4") compile("org.slf4j:slf4j-api:1.7.5") compile("org.slf4j:slf4j-simple:1.7.5") compile("joda-time:joda-time:2.3") } //these are only downloaded when running the test task dependenciesTest { compile("junit:junit:4.9") compile("org.mockito:mockito-all:1.9.5") compile("org.apache.httpcomponents:httpcore:4.3.3") compile("org.apache.httpcomponents:httpclient:4.5.1") } //tells kobalt to produce a jar assemble { jar { } } }
If you're using Intellij IDEA, make sure you've installed the Kobalt plugin and then go to Kobalt -> Sync Build File. This will download dependencies in a way that IDEA understand so you no loger get errors.