forked from LBNL-UCB-STI/beam
-
Notifications
You must be signed in to change notification settings - Fork 1
Creating a BEAM JAR
atchley-sha edited this page Aug 11, 2021
·
3 revisions
- Once your BEAM project is running on an IDE like IntelliJ, go to your build.gradle file.
- We're going to build a fatJar, which is an executable file that includes all of the dependencies in the jar.
- We will need an additional plugin for creating the fatJar. In build.gradle, put this plugin into the plugins section: [id "com.github.johnrengelman.shadow" version "5.2.0"] // Shadow helps create fatJars
Your plugins should look similar to this:
plugins {
id "net.ltgt.apt" version "0.5"
id "de.undercouch.download" version "3.2.0"
id "org.scoverage" version "2.5.0"
id 'maven-publish'
id "me.champeau.gradle.jmh" version "0.5.0"
id "com.github.johnrengelman.shadow" version "5.2.0" // Shadow helps create fatJars
}
- In the same build.gradle file, scroll down to under
tasks.withType(scalaCompile){}
- Copy and paste this under
tasks.withType(scalaCompile){}
[not the line of code, the entire section]
mainClassName = 'beam.sim.RunBeam'
shadowJar{
zip64 true
mergeServiceFiles('reference.conf')
manifest{
attributes 'Main-Class': mainClassName
}
}
Also check to see if there is another line in the build.gradle that sets the mainClassName
(I believe it is a couple hundred lines earlier, but I could be wrong). This line can be deleted/commented/whatever so Shadow doesn't get confused (I'm not actually sure what happens if you have two different mainClassName
s, but no need to try fate).
-
Compile the jar using this command while in your BEAM project directory:
gradle shadowJar
-
Your new JAR should be in BEAM\build\libs
-
To execute your jar, use this command while in your BEAM project directory:
java -jar -Xmx8g .\build\libs\beam-0.8.0-all.jar --config test/input/beamville/beam.conf
This example is using the default scenario BEAMVILLE.
- You will need the additional input files for your scenario as well, otherwise you'll get a error for missing files.