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

亡梦爱人 提交于 2019-12-09 14:58:13

问题


Writing this for users who have future issues like me. Libraries that are built on the Typesafe config typically use their own reference.conf files and refer to certain configuration keys. When building a fat JAR using the Gradle shadowJAR plugin, these files aren't included.

Dependencies like Spray and Akka throw errors when the fat JAR attempts to run. Errors look like:

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 this? Check the answer below.


回答1:


The resulting fix was to add the following to the build.gradle file:

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

Solution was found here:http://www.sureshpw.com/2015/10/building-akka-bundle-with-all.html



来源:https://stackoverflow.com/questions/34326168/how-can-i-fix-missing-conf-files-when-using-shadowjar-and-scala-dependencies

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!