2. Creating new project(s)

The golo new command can create new Golo project(s):

$ golo new Foo

The command creates a new Golo module named Foo in a main.golo file with a simple function named main that takes an argument for the JVM program arguments.

By default we create a new free-form project but you can specify the type of project with the --type command argument. Three types of projects are currently available:

As an example if you want to create a Maven-driven project, just add --type maven:

$ golo new Foo --type maven

By default we create the project directory where the golo command is run. If you need to create your project directory elsewhere you can use the --path command argument:

$ golo new Bar --path /opt/golo

This creates the project directory named Bar in /opt/golo.

2.1. Free-form project

The structure of a free-form project is as follows:

$ tree Foo
Foo
├── imports
├── jars
└── main.golo

2.2. Maven-driven project

The structure of a Maven-driven project is as follows:

$ tree Foo
Foo
├── pom.xml
└── src
    └── main
        └── golo
            └── main.golo

The project can be built and packaged with Maven using the following command:

$ mvn package

You can now run the module Foo with:

  • mvn
$ mvn exec:java
  • java
$ java -jar target/Foo-*-jar-with-dependencies.jar
  • golo
$ cd target/classes
$ golo run --module Foo

2.3. Gradle-driven project

The structure of a Gradle-driven project is as follows:

$ tree Foo
Foo
├── build.gradle
└── src
    └── main
        └── golo
            └── main.golo

The project can be built and packaged with Gradle using the following command:

$ gradle build

You can now run the module Foo with:

  • gradle
$ gradle run
  • golo
$ cd build/classes/main
$ golo run --module Foo