mirror of
https://github.com/ethauvin/kobalt-doc.git
synced 2025-04-25 03:57:11 -07:00
Update archetype doc.
This commit is contained in:
parent
81ef95763e
commit
b55a44b42f
4 changed files with 43 additions and 60 deletions
|
@ -58,72 +58,55 @@ unzip kobalt-xxx.zip
|
|||
</p>
|
||||
<pre class="brush:plain">
|
||||
cd ~/java/project
|
||||
$KOBALT_HOME/kobaltw --init
|
||||
$KOBALT_HOME/kobaltw --init java
|
||||
</pre>
|
||||
<p>
|
||||
This command will do two things:
|
||||
</p>
|
||||
<ol>
|
||||
<li>Create a default <code>kobalt/src/Build.kt</code> file based on what was found in your project.
|
||||
<li>Install the Kobalt Wrapper in your current directory (a script called <code>kobaltw</code>) and a few additional files in the <code>kobalt/wrapper</code> directory. From now on, you can just use <code>./kobaltw</code> to build and you can ignore <code>$KOBALT_HOME</code>.
|
||||
</ol>
|
||||
<p>
|
||||
You can now attempt to build your project with Kobalt:
|
||||
</p>
|
||||
<li>Create a default <code>kobalt/src/Build.kt</code> suitable for a brand new Java project.
|
||||
<li>Install the Kobalt Wrapper in your current directory (a script called <code>kobaltw</code>) and a few additional files in the <code>kobalt/wrapper</code> directory. From now on, you can just use <code>./kobaltw</code> to build and you can ignore <code>$KOBALT_HOME</code>.
|
||||
</ol>
|
||||
<p>
|
||||
You can now attempt to build your project with Kobalt:
|
||||
</p>
|
||||
<pre class="brush:plain">
|
||||
./kobaltw assemble
|
||||
</pre>
|
||||
If your project follows a regular build structure (e.g. <a href="https://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html">Maven's hierarchy</a>), this should compile your file and create a .jar file. If not, you will have to make a few edits to your <code>Build.kt</code>.
|
||||
As of this writing, Kobalt supports Java and Kotlin projects.
|
||||
|
||||
<h2 class="section" id="edit">3. Edit kobalt/src/Build.kt</h2>
|
||||
If your project follows a regular build structure (e.g. <a href="https://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html">Maven's hierarchy</a>), this should compile your file and create a .jar file. If not, you will have to make a few edits to your <code>Build.kt</code>.
|
||||
As of this writing, Kobalt supports Java and Kotlin projects.
|
||||
|
||||
Here is the <code>Build.kt</code> for the <a href="https://github.com/hhariri/wasabi/blob/master/kobalt/src/Build.kt">Wasabi HTTP framework</a>:
|
||||
<h2 class="section" id="edit">3. Edit kobalt/src/Build.kt</h2>
|
||||
|
||||
<p>The build file generated by default might need some editing before you can build your project, so take a look at it and adjust whatever is necessary (e.g. package name, version, etc...)</p>
|
||||
<p>
|
||||
Here is the <code>Build.kt</code> for the <a href="https://github.com/cbeust/jcommander/blob/master/kobalt/src/Build.kt">JCommander project</a>:
|
||||
</p>
|
||||
<pre class="brush:java">
|
||||
import com.beust.kobalt.*
|
||||
import com.beust.kobalt.plugin.packaging.assemble
|
||||
import com.beust.kobalt.plugin.kotlin.*
|
||||
import com.beust.kobalt.plugin.java.*
|
||||
import com.beust.kobalt.plugin.packaging.*
|
||||
import com.beust.kobalt.plugin.publish.*
|
||||
|
||||
val kotlinVersion = "1.0.0-beta-4583"
|
||||
|
||||
val p = kotlinProject {
|
||||
|
||||
name = "wasabi"
|
||||
group = "com.example"
|
||||
val jcommander = project {
|
||||
name = "jcommander"
|
||||
group = "com.beust"
|
||||
artifactId = name
|
||||
version = "0.1"
|
||||
version = "1.54"
|
||||
|
||||
// Tell Kobalt to also search here for dependencies
|
||||
val repos = repos("http://oss.sonatype.org/content/repositories/snapshots")
|
||||
|
||||
dependencies {
|
||||
compile("org.jetbrains.kotlin:kotlin-stdlib:" + kotlinVersion,
|
||||
"org.jetbrains.kotlin:kotlin-reflect:" + kotlinVersion,
|
||||
|
||||
"io.netty:netty-all:4.0.31.Final",
|
||||
"commons-codec:commons-codec:1.6",
|
||||
"commons-logging:commons-logging:1.1.1",
|
||||
"joda-time:joda-time:2.3")
|
||||
}
|
||||
|
||||
// Test dependencies
|
||||
dependenciesTest {
|
||||
compile("junit:junit:4.9",
|
||||
"org.mockito:mockito-all:1.9.5",
|
||||
"org.apache.httpcomponents:httpclient:4.5.1")
|
||||
compile("org.testng:testng:6.9.9")
|
||||
}
|
||||
|
||||
// Tell kobalt to produce a fat jar and also the artifacts required for Maven
|
||||
assemble {
|
||||
jar {
|
||||
fatJar=true
|
||||
name = "wasabi-fat-" + version + ".jar"
|
||||
}
|
||||
mavenJars{
|
||||
mavenJars {
|
||||
}
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
|
||||
jcenter {
|
||||
publish = true
|
||||
}
|
||||
}</pre>
|
||||
|
||||
<h2 class="section" id="idea-plugin">4. Sync your build file</h2>
|
||||
<p>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue