-
Notifications
You must be signed in to change notification settings - Fork 83
Home
Notes for O’Reilly Learning Platform course on Safari Books Online
Ken Kousen
[email protected]
@kenkousen
This document is for notes that come up during class. It’s also an easy way to share code and other materials.
GitHub repo for book: https://github.com/kousen/kotlin-cookbook
GitHub repo for my version of JetBrains workshop: https://github.com/kousen/kotlin-workshop
Set-up info:
-
Java 8 or Java 11
-
Kotlin 1.3+ (we’ll use the latest version, whatever it is)
IDE:
-
IntelliJ IDEA
-
Community edition (free) has Kotlin support
-
Ultimate edition has many more capabilities
-
-
Android Studio (free) has Kotlin support
While we’ll discuss how to use Maven with Kotlin, I personally prefer Gradle and am much more comfortable solving problems with it. You do not need to install Gradle yourself. Instead, each project will contain what is called a Gradle wrapper, which is a script that will download and install Gradle when first executed. The wrapper will install Gradle into ~/.gradle/wrapper/dists
, where the tilde (~) represents your home directory. You can always delete the installation later — no changes are made to your system environment or registry.
If you have a proxy between you and the Internet, you’ll need to tell Gradle to use it. To do so, add a file called gradle.properties
in the ~/.gradle
folder (creating it if necessary) with the following settings:
systemProp.http.proxyHost=www.somehost.org
systemProp.http.proxyPort=8080
systemProp.http.proxyUser=userid
systemProp.http.proxyPassword=password
systemProp.http.nonProxyHosts=*.nonproxyrepos.com|localhost
systemProp.https.proxyHost=www.somehost.org
systemProp.https.proxyPort=8080
systemProp.https.proxyUser=userid
systemProp.https.proxyPassword=password
systemProp.https.nonProxyHosts=*.nonproxyrepos.com|localhost
Alternatively, you can add this file to each project’s root. That will work, but if you save it into ~/.gradle
, the settings will apply to every Gradle build on your system.
We’ll go over how to use Gradle during the class. If you prefer to use Maven, you’re welcome to do so, but if you run into any difficulties you’ll have to solve them yourself.