tags:

views:

68

answers:

2

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.

+1  A: 

Use scala-archetype-simple archetype. Here are the list of other archetypes.

Teja Kantamneni
This doesn't actually handle any of the dependency issues.
Dr. Guildo
+7  A: 

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.

Travis Brown
Thanks, that seems to work great. The only other problem I had was that it wasn't configuring the manifest but I found a solution to that here: http://maven.apache.org/plugins/maven-assembly-plugin/usage.html
Dr. Guildo