Running a "main(args: Array[String])"

You must have a well define project, and it must compile your code successfully before (see Compiling ).

Running

So you can now run your scala app by defining the "mainClass" property :

mvn scala:run -DmainClass=org.example.MyClass

Predefining mainClass

Adding the mainClass configuration to your plugin definition.

  <plugin>
    <groupId>maven</groupId>
    <artifactId>maven-scala-plugin</artifactId>
    <configuration>
      <mainClass>org.example.MyClass</mainClass>
    </configuration>
  </plugin>
      

Now you can run the following command to run your scala app.

mvn scala:run

Set the property maven.scala.displayCmd to true, to display the command line used