Reputation: 5612
I have a 900MB jar (stanford-corenlp-models) that I want to exclude from dist so the generated zip file is smaller. I want it back on classpath at the time of deployment.
I added it to build.sbt
as
"edu.stanford.nlp" % "stanford-corenlp" % "3.9.1" % "provided" classifier "models-english"
I'm adding it back to /lib
during deployment, but its not loaded onto classpath.
Is there a different way to achieve this? My run command looks like
./bin/my-server -Dhttp.port=8080 -Dconfig.file=conf/prod.conf -J-Xmx512m -J-server &
Upvotes: 0
Views: 505
Reputation: 27595
"provided"
is the way to go.
If you are able to pass arguments to java
you can add library back to your class path
your-applicatiom -cp stanford-corenlp.jar:. # ; instead of : on Windows
(I recommend some reading on it as you are replacing old class path, not pre-/appending to it, so you should manually preserve what is already there).
What I learned though, is that you might end up with the library anyway if some of the dependencies pass it as a transitive compile dependency. In such case you have to figure out which (I recommend sbt-depenency-graph and dependencyBrowseGraph
task) and exclude it.
libraryDepenencies += "x" %% "y" % "z" excludeAll (ExclusionRule(...))
Upvotes: 1