Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Including scala-library.jar in Maven generated package

Tags:

maven

jar

scala

I'd like to use Maven to include all the dependencies needed to run any Scala programs I write. I imagine this would mean at least scala-library.jar as well as any libraries I may use.

I don't mind where these dependencies are stored (inside the generated JAR or outside), I'm just looking for a solution that sets up stuff like the manifest file classpath and generally requires a minimum amount of manual intervention and boilerplate configuration.

Thanks.

like image 604
Simon Morgan Avatar asked Dec 16 '22 22:12

Simon Morgan


1 Answers

You can use the jar-with-dependencies descriptor format that comes with the Assembly plugin:

<plugin>
  <artifactId>maven-assembly-plugin</artifactId>
  <configuration>
    <descriptorRefs>
      <descriptorRef>jar-with-dependencies</descriptorRef>
    </descriptorRefs>
  </configuration>
</plugin>

When you run mvn assembly:assembly you'll get a jar with all dependencies (including any necessary Scala libraries) in your target directory.

like image 161
Travis Brown Avatar answered Jan 05 '23 16:01

Travis Brown