How can I fix missing conf files when using the shadowJar and Scala dependencies?

Writing this for users who have future issues like me. Libraries that are built on Typesafe configs typically use their own reference.conf files and reference specific configuration keys. When creating a fat JAR using the Gradle shadowJAR these files are not included.

Dependencies such as Spray and Akka cause errors when trying to run the JAR. Errors look like this:

 Exception in thread "main" com.typesafe.config.ConfigException$Missing: No configuration setting found for key 'spray' Exception in thread "main" com.typesafe.config.ConfigException$Missing: No configuration setting found for key 'akka' 

How to fix it? Check out the answer below.

+5
source share
1 answer

As a result, the following was added to the build.gradle file:

 shadowJar { transform(com.github.jengelman.gradle.plugins.shadow.transformers.AppendingTransformer) { resource = 'reference.conf' } } 

The solution is found here: http://www.sureshpw.com/2015/10/building-akka-bundle-with-all.html

+7
source

Source: https://habr.com/ru/post/1238459/


All Articles