Comment on page
Tutorial: Create an AutoMan Project
Once you have Java, Scala, and
sbtinstalled (if you don't go back to Installing Prerequisites), you can create an AutoMan project. Note that these instructions assume that you are familiar with the command line on a UNIX machine. You can run AutoMan in other operating systems, like Windows, but you will need to adapt the instructions below.
We're going to start by creating a new directory for our project. This will create a new directory in our current location.
$ mkdir my-first-automan-project
Now go ahead and
cdinto that directory.
$ cd my-first-automan-project
sbtproject, there are two primary components:
build.sbt: Is a build specification, where you will configure your library dependencies, among other things.
src: Is a directory where you will store your application code.
Let's start by creating a
build.sbtfile. I am going to do this with
emacs build.sbtbut you can use any text editor with which you are comfortable. Paste the following into your
scalaVersion := "2.12.12"
name := "my-first-automan-app"
version := "1.0"
libraryDependencies += "org.automanlang" %% "automan" % "1.4.2"
Most of this should be self-explanatory, but I will explain anyway. Note that you must use the
:=assignment operator and not
scalaVersion: The version of Scala you want to use. I have specified the latest version of Scala 2.12 at the time of this writing. If you don't have this precise version of Scala on your machine, don't worry,
sbtwill install it for you. Note that AutoMan does not currently support Scala 2.13.
name: The name of your application.
version: The version of your application. This won't be all that important for this example, but if you ever decide to publish your app, this number will be used as a part of your app's metadata.
libraryDependencies: This is where we specify that our app depends on one or more third-party libraries. I have pre-filled this entry with the dependency information for the latest version of AutoMan.
sbtwill automatically download and install whatever dependencies you specify. Observe that we use
libraryDependencies; this is because
libraryDependenciesis a list.
+=adds a dependency to that list.
You can find more libraries at MVNrepository. For example, here is the MVNrepository page for AutoMan. Note the "SBT" tab which includes the line we pasted into our
build.sbtfile above. You can include any third-party library you find in MVNrepository, with some small caveats, most notably that some libraries are tied to specific versions of Scala. Just add another
Let's now create our
sbtsaves you configuration work by being rather picky about where you store your source code. Let's create that location:
$ mkdir -p src/main/scala
And let's create a new Scala file in that folder (again, use your favorite text editor):
$ emacs src/main/scala/MyFirstAutoManApp.scala
Once you have a new, blank
MyFirstAutoManApp.scalafile loaded up in your editor, we can start creating our app.