且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

可执行的Jar在类路径上找不到typesafe/config application.conf

更新时间:2022-03-09 06:17:27

我遇到了同样的问题...

As I just had the same problem...

-jar会覆盖所有类路径设置,因此只能看到jar. -Dconfig.trace=loads将显示Java看到的内容.

The -jar overrides all classpath settings, so only the jar is seen. -Dconfig.trace=loads will show what is seen by java.

我们想要classpath和jar上的application.conf,所以: java -cp .:my-reports-1.0-SNAPSHOT.jar full.path.to.main.Main 为我做了把戏.找到了application.conf并覆盖了jar中的reference.conf.

We want the application.conf on the classpath, as well as the jar, so: java -cp .:my-reports-1.0-SNAPSHOT.jar full.path.to.main.Main did the trick for me. application.conf found and overrides reference.conf in the jar.