1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt-doc.git synced 2025-04-25 03:57:11 -07:00

Document the "idea" template.

This commit is contained in:
Cedric Beust 2016-02-25 23:09:36 +04:00
parent a091734a58
commit 134892b514

View file

@ -63,8 +63,20 @@ Change to your project directory and call the <code>kobaltw</code> command with
</p>
<pre class="brush:plain">
cd ~/java/project
kobaltw --init java
</pre>
kobaltw --init java</pre>
to initialize a Java project, or
<pre class="brush:plain">
cd ~/java/project
kobaltw --init kotlin</pre>
<p>
to initialize a Kotlin project.
</p>
<div class="bs-callout bs-callout-warning">
<h4>Note</h4>
Kobalt supports projects with both Kotlin and Java sources. For such projects,
use either <code>java</code> or <code>kotlin</code> as the <code>--init</code> argument and refer to the <a href="../plug-ins/index.html#mixed-projects">mixed projects documentation</a> for more details.
</div>
<p>
This command will do two things:
</p>
@ -75,18 +87,11 @@ This command will do two things:
<p>
From now on, you can just use <code>./kobaltw</code> to build and you can ignore the <code>kobaltw</code> on your path (this command is only useful for initializing projects).
</p>
<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>
<p>
If your project uses a standard folder structure, you can skip this section and try to build your project directly.
</p>
<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>:
@ -116,15 +121,36 @@ val jcommander = project {
publish = true
}
}</pre>
<h2 class="section" id="build">4. Build your project</h2>
<p>
You can now attempt to build your project with Kobalt:
</p>
<pre class="brush:java">
./kobaltw assemble</pre>
<h2 class="section" id="idea-plugin">5. IDEA users: generate IDEA files</h2>
<p>
If you are planning to use IDEA to work on your project, you can ask Kobalt to generate all the IDEA files necessary to import your project:
</p>
<pre class="brush:java">
./kobaltw --init idea
</pre>
<h2 class="section" id="idea-plugin">4. Sync your build file</h2>
<div class="bs-callout bs-callout-warning">
<h4>Note</h4>
You need to have a valid <code>Build.kt</code> file for this command to work.
</div>
<p>
This will generate several files depending on the content of your build file. You can then launch IDEA and open this project directly.
</p>
<h2 class="section" id="idea-plugin">6. IDEA users: sync your 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 <code>Kobalt -> Sync Build File</code>. Once the build file is synchronized, the errors should disappear
and you can now use all the regular functions of IDEA on <code>Build.kt</code> just like any other Kotlin
files (auto completion, jump to symbol, etc...).
</p>
<h2 class="section" id="next-steps">5. Next steps</h2>
<h2 class="section" id="next-steps">7. Next steps</h2>
<p>
From this point, you can either <a href="../idea-plug-in/index.html">learn how to install the Kobalt IDEA plug-in</a> or read <a href="../documentation/index.html">Kobalt's documentation</a>.
</p>