Executable Jar cannot find typesafe/config application.conf on classpath

后端 未结 2 941
天命终不由人
天命终不由人 2021-01-14 08:53

I have a command line app that downloads some reports, processes them, then uploads data to Google Drive. I\'m using Typesafe-Config for all the magic strings I need. Typesa

相关标签:
2条回答
  • 2021-01-14 09:05

    I also had that issue. I've noticed that you use a Class-Path declaration in shaded configuration, so I've merged the answer by Lothar with your info and added:

    <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
        <manifestEntries>
            <Main-Class>com.my.reports.ReportRunner</Main-Class>
                <Class-Path>.</Class-Path>
        </manifestEntries>
    </transformer>
    
    0 讨论(0)
  • 2021-01-14 09:19

    As I just had the same problem...

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

    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.

    0 讨论(0)
提交回复
热议问题