0

It might be a stupid question, but I can't get my wrap my head around it.

How to execute a jar created with maven package that brings quite a few dependencies with it (the resulting jar is 100MB)?

I don't have a mainClass but I wish to run it depending on the modules I want to execute.

Things I tried:

1.

scala  my_app_2.0.1-jar-with-dependencies.jar App1


    java.lang.NullPointerException
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:348)
        at scala.reflect.internal.util.ScalaClassLoader.$anonfun$tryClass$1(ScalaClassLoader.scala:44)
        at scala.util.control.Exception$Catch.$anonfun$opt$1(Exception.scala:242)
        at scala.util.control.Exception$Catch.apply(Exception.scala:224)
        at scala.util.control.Exception$Catch.opt(Exception.scala:242)
        at scala.reflect.internal.util.ScalaClassLoader.tryClass(ScalaClassLoader.scala:44)

2.

scala -classpath my_app_2.0.1-jar-with-dependencies.jar package.path.App1

java.lang.NoSuchMethodError: scala.Predef$.refArrayOps([Ljava/lang/Object;)Lscala/collection/mutable/ArrayOps;
    at org.rogach.scallop.ScallopConf.performOptionNameGuessing(ScallopConf.scala:17)
    at org.rogach.scallop.ScallopConfBase.verifyConf(ScallopConfBase.scala:686)
    at org.rogach.scallop.ScallopConfBase.verify(ScallopConfBase.scala:698)
    at iit.cnr.it.socialpipeline.utils.ArgConf.<init>(ArgConf.scala:19)
...
salvob
  • 1,300
  • 3
  • 21
  • 41

2 Answers2

1

ANSWERING TO MYSELF, for future reference.

Well since you created the jar with maven that works with java and since you used scala-plugin, and this is inside the dependencies you just need to use the command:

java -classpath my_app_2.0.1-jar-with-dependencies.jar package.path.App1

easy as that, you noob - no offense (well, I am answering to myself. So I think it's pretty fair to be rude to myself :D ).

salvob
  • 1,300
  • 3
  • 21
  • 41
0

Since it can be run as a normal java program, you can use the Exec Maven Plugin. I confirm that it is viable