What options are available to simulate "sbt run" in Maven?

In a project where I use the scala language , sbt can run the command directly from the terminal:

sbt run

      

I have now switched to using java with maven . If I try to run in terminal:

mvn run 

      

the command doesn't work. Mistake:

[ERROR] Unknown lifecycle phase "run" ...

      

Is there an alternative way to do this? Many thanks.

+3


source to share


1 answer


Use the maven exec plugin .

mvn exec:java -Dexec.mainClass="com.example.Main" [-Dexec.args="argument1"] ...



You can configure the plugin in yours pom.xml

to specify what should be the default main class and default arguments.

0


source







All Articles