honeyAndSw / vertx-microservices-workshop-scala

Scala Vert.x project inspired by vertx-microservices-workshop
3 stars 0 forks source link

Set Main-Class/Main-Verticle #2

Closed honeyAndSw closed 7 years ago

honeyAndSw commented 7 years ago

Using the Launcher in fat jars

To use the Launcher class in a fat-jar just set the Main-Class of the MANIFEST to io.vertx.core.Launcher. In addition, set the Main-Verticle MANIFEST entry to the name of your main verticle. By default, it executed the run command. However, you can configure the default command by setting the Main-Command MANIFEST entry. The default command is used if the fat jar is launched without a command.

sbt - Configure packaging : Read MANIFEST in build.sbt

packageOptions in (Compile, packageBin) +=  {
  val file = new java.io.File("META-INF/MANIFEST.MF")
  val manifest = Using.fileInputStream(file)( in => new java.util.jar.Manifest(in) )
  Package.JarManifest( manifest )
}
honeyAndSw commented 7 years ago

Custom Main-Class in MANIFEST doesn't work.