vikrant rana
vikrant rana

Reputation: 4674

added external jar to sbt project- not working

We have a mulimoudle SBT project running with moultingyml version 0.4.2 which internally uses. snakeyaml version 1.26.

However, this snakeyaml version has 3MB limit for the max amount of code points in the input YAML document.

inside LoaderOptions.java

private int codePointLimit = 3 * 1024 * 1024; // 3 MB

Due to some dependencies we need to overwrite this limit from 3MB to 10MB. So, we are overwriting it.

def parseYaml(allowDuplicateKeys: Boolean = true, allowRecursiveKeys: Boolean = false, wrappedToRootException: Boolean = false, maxAliasesForCollections: Int = 50) = {
  val loaderOptions = new LoaderOptions()

 loaderOptions.setCodePointLimit(10 * 1024 * 1024)

we are getting problems while including this modified version of moultingyml package to our main project fat jar.

I did try adding this File-->project structure-->libraries but it didn't work.

Later added lib folder and placed moultingyml jar there. It has removed the import errors in the main jar but getting below error messages when building the fat jar.

sbt clean assembly


←[0m[←[0m←[31merror←[0m] ←[0m←[0merror while loading YamlNull, class file 'C:\Users\XXXXX\AppData\Local\Google\Cloud SDK\digi\pm-cm\spark-jobs\testmodule\lib\moultingyaml_2.13-0.4.3-SNAPSHOT.jar(net/jcazevedo/moultingyaml/YamlNull.class)' is broken←[0m←[0J
←[0J←[1000D
←[2K←[2K  | => testproject / Compile / compileIncremental 3s
←[2K←[2A←[1000D←[0m[←[0m←[31merror←[0m] ←[0m←[0m(class java.lang.RuntimeException/error reading Scala signature of YamlNull.class: Scala signature YamlN
ull has wrong version←[0m←[0J
←[0J←[1000D
←[2K←[2K  | => testproject/ Compile / compileIncremental 3s
←[2K←[2A←[1000D←[0m[←[0m←[31merror←[0m] ←[0m←[0m expected: 5.0←[0m←[0J
←[0J←[1000D
←[2K←[2K  | => testproject/ Compile / compileIncremental 3s
←[2K←[2A←[1000D←[0m[←[0m←[31merror←[0m] ←[0m←[0m found: 5.2 in YamlNull.class)←[0m←[0J
←[0J←[1000D

Upvotes: 1

Views: 57

Answers (1)

Martin Stone
Martin Stone

Reputation: 13007

... Scala signature YamlNull has wrong version

Ensure that you built your JAR with the same Scala version that your main project uses.

Upvotes: 1

Related Questions