sbt-assembly icon indicating copy to clipboard operation
sbt-assembly copied to clipboard

How to package different JARs based on different classes?

Open fluency03 opened this issue 7 years ago • 2 comments

When I want to deploy the jobs to Flink, I have to submit the each of the job as a JAR.

For example, if I have several different jobs under the module: org.example:

  • WordCount
  • SocketTextStreamWordCount
  • WikipediaEditMonitoring
  • etc...

My question is: how to package the jobs to each of their separate JARs, so that I can submit each of the jobs to Fink separately, like:

  • WordCount-%version.jar
  • SocketTextStreamWordCount-%version.jar
  • WikipediaEditMonitoring-%version.jar
  • etc...

More specifically, how to configure the build.sbt or set up the sbt project structure?

For example, in the Apache Flink, there is such flink-examples-streaming module and its pom.xml is here: https://github.com/apache/flink/blob/master/flink-examples/flink-examples-streaming/pom.xml .

Inside its pom, there is a maven-jar-plugin, and it has several different executions for each of the example. Inside each execution, its corresponding program-class and included files are specified. Therefore, each execution is going to generate a single JAR file for this individual job.

I would like to know how to do such thing in sbt-assembly.

Many Thanks.

sbt version: 0.13.13

fluency03 avatar Nov 06 '17 09:11 fluency03

@fluency03 hi,i got the same question too. only find that the mainClass should has a configuration in build.sbt is according to sbt-assemblt-doc

mainClass in assembly := Some("org.example.SocketWordCount"),

a dirty way i got is separating these jars into different project and specify there own mainClass in there project configurations.

have u got any better idea about this question?

thank you very much.

Garlandal avatar Jan 16 '19 03:01 Garlandal

got something in flink-doc about command line usage screen shot 2019-01-16 at 11 52 42 -c option can specify mainClass, maybe i should package above all into one jar file and specify it on job submitting.

Garlandal avatar Jan 16 '19 03:01 Garlandal