1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt-doc.git synced 2025-06-16 09:10:51 -07:00

improve getting-started

This commit is contained in:
Juan Liska 2016-01-05 06:08:38 -06:00
parent dd21509bd0
commit 0b39add1b9

View file

@ -1,153 +1,154 @@
<html> <html>
<head> <head>
<title> <title>
Kobalt, by Cedric Beust
Kobalt, by Cedric Beust </title>
<script type="text/javascript" src="../sh/scripts/shCore.js"></script>
</title> <script type="text/javascript" src="../sh/scripts/shBrushJScript.js"></script>
<script type="text/javascript" src="../sh/scripts/shBrushJava.js"></script>
<script type="text/javascript" src="../sh/scripts/shCore.js"></script> <script type="text/javascript" src="../sh/scripts/shBrushPlain.js"></script>
<script type="text/javascript" src="../sh/scripts/shBrushJScript.js"></script> <script>
<script type="text/javascript" src="../sh/scripts/shBrushJava.js"></script> SyntaxHighlighter.defaults['gutter'] = false;
<script type="text/javascript" src="../sh/scripts/shBrushPlain.js"></script> SyntaxHighlighter.defaults['toolbar'] = false;
SyntaxHighlighter.all();
<script> </script>
SyntaxHighlighter.defaults['gutter'] = false; <!--[if lt IE 9]><script src="../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
SyntaxHighlighter.defaults['toolbar'] = false; <!--
SyntaxHighlighter.all(); <script src="../bootstrap/assets/js/ie-emulation-modes-warning.js"></script>
</script> -->
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<!--[if lt IE 9]><script src="../assets/js/ie8-responsive-file-warning.js"></script><![endif]--> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<!-- <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<script src="../bootstrap/assets/js/ie-emulation-modes-warning.js"></script> <![endif]-->
--> <!-- Favicons -->
<!--
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> <link rel="icon" href="/favicon.ico">
<!--[if lt IE 9]> -->
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
<![endif]--> (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
<!-- Favicons --> })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
<!-- ga('create', 'UA-238215-6', 'auto');
<link rel="icon" href="/favicon.ico"> ga('send', 'pageview');
--> </script>
</head>
<script> <body>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ <div class="container">
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), <!-- Static navbar -->
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) <nav id="kobalt-navbar" class="navbar navbar-default">
})(window,document,'script','//www.google-analytics.com/analytics.js','ga'); </nav>
<div class="col-md-9">
ga('create', 'UA-238215-6', 'auto'); <h2 class="section" id="downloading">1. Download Kobalt</h2>
ga('send', 'pageview'); <p>
<a href="https://github.com/cbeust/kobalt/releases/latest">Download the zip file</a> then unzip it in a location we'll call <code>KOBALT_HOME</code>:
</script> </p>
</head>
<body>
<div class="container">
<!-- Static navbar -->
<nav id="kobalt-navbar" class="navbar navbar-default">
</nav>
<!-- Main component for a primary marketing message or call to action -->
<div class="jumbotron">
<!--
<p>
<a class="btn btn-lg btn-primary" href="../../components/#navbar" role="button">Download &raquo;</a>
</p>
-->
</div>
<div class="col-md-9">
<h2 class="section" id="downloading">1. Download Kobalt</h2>
<p>
<a href="https://github.com/cbeust/kobalt/releases/latest">Download the zip file</a> then unzip it in a location we'll call <code>KOBALT_HOME</code>:
</p>
<pre class="brush:plain"> <pre class="brush:plain">
cd $KOBALT_HOME cd $KOBALT_HOME
unzip kobalt-xxx.zip unzip kobalt-xxx.zip
</pre> </pre>
<h2 class="section" id="initialize">2. Initialize your project for Kobalt</h2>
<h2 class="section" id="downloading">2. Initialize your project for Kobalt</h2> <p>
Change to your project directory and call the <code>kobaltw</code> command with <code>--init</code>:
<p> </p>
Change to your project directory and call the <code>kobaltw</code> command with <code>--init</code>:
</p>
<pre class="brush:plain"> <pre class="brush:plain">
cd ~/java/project cd ~/java/project
$KOBALT_HOME/kobaltw --init $KOBALT_HOME/kobaltw --init
</pre> </pre>
<p>
<p> This command will do two things:
This command will do two things: </p>
</p> <ol>
<li>Create a default <code>kobalt/src/Build.kt</code> file based on what was found there.
<ol> <li>Install the Kobalt Wrapper in your current directory (script `kobaltw`) and in the <code>kobalt/</code> directory. From now on, you can just use <code>./kobaltw</code> to build and you can ignore <code>$KOBALT_HOME</code>.
<li>Create a default <code>kobalt/src/Build.kt</code> file based on what was found there. </ol>
<li>Install the Kobalt Wrapper in your current directory (script `kobaltw`) and in the <code>kobalt/</code> directory. From now on, you can just use <code>./kobaltw</code> to build and you can ignore <code>$KOBALT_HOME</code>. <p>
</ol> You can now attempt to build your project with Kobalt:
</p>
<p>
You can now attempt to build your project with Kobalt:
</p>
<pre class="brush:plain"> <pre class="brush:plain">
./kobaltw assemble ./kobaltw assemble
</pre> </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>. Here for example is the Build.kt for wasabi http framework
As of this writing, Kobalt supports Java and Kotlin projects.
<h2 class="section" id="structure">3. Edit Build.kt</h2>
<pre class="brush:java"> <pre class="brush:java">
import com.beust.kobalt.* import com.beust.kobalt.*
import com.beust.kobalt.plugin.kotlin.kotlinProject import com.beust.kobalt.plugin.packaging.assemble
import com.beust.kobalt.plugin.kotlin.*
val kobalt = kotlinProject { val kotlin_version = "1.0.0-beta-4583"
name = "kobalt"
group = "com.beust" val p = kotlinProject {
name = "wasabi"
group = "com.example"
artifactId = name artifactId = name
version = "0.62" version = "0.1"
directory = homeDir("kotlin/kobalt")
//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 {
}
}
} }
</pre> </pre>
</div> <h2 class="section" id="idea-plugin">4. In Intellij IDEA, Sync Build File</h2>
<p>
If you're using Intellij IDEA, make sure you've <a href="../idea-plug-in/index.html">installed the Kobalt plugin</a> and then go to Kobalt -> Sync Build File. This will download dependencies in a way that IDEA understand so you no loger get errors.
</p>
</div>
<!-- Table of contents --> <!-- Table of contents -->
<div class="col-md-3" id="table-of-contents"> <div class="col-md-3" id="table-of-contents">
</div> </div>
</div> <!-- /container --> </div> <!-- /container -->
<!-- Bootstrap core JavaScript
<!-- Bootstrap core JavaScript ================================================== -->
================================================== --> <!-- Placed at the end of the document so the pages load faster -->
<!-- Placed at the end of the document so the pages load faster --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script src="../bootstrap/dist/js/bootstrap.min.js"></script>
<script src="../bootstrap/dist/js/bootstrap.min.js"></script> <script src="../js/kobalt.js"></script>
<script src="../js/kobalt.js"></script> <script>generateKobalt(1);</script>
<script>generateKobalt(1);</script> <!--
<script src="../bootstrap/dist/js/docs.min.js"></script>
<!-- -->
<script src="../bootstrap/dist/js/docs.min.js"></script> <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
--> <!--
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> <script src="../../assets/js/ie10-viewport-bug-workaround.js"></script>
<!-- -->
<script src="../../assets/js/ie10-viewport-bug-workaround.js"></script> </body>
-->
</body>