I have spring boot application (1.3.5.RELEASE) which is packaged as a jar file and i would like to have the jdbc drivers in an external libs folder. So i am using the PropertiesLauncher which searches for external jar files.
It works fine when using java -jar -Dloader.path=lib/ but is does not work inside the Intellij IDE. Its a Maven project which is imported into Intellij.
Any hints for me?
Following the answer of Andy I thought I will post how I did resolved it:
I've added a profile for the dependency
<profile>
    <id>intellij-properties-launcher</id>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-loader</artifactId>
            <version>2.0.6.RELEASE</version>
        </dependency>
    </dependencies>
</profile>
I activated the profile on Intellij on the maven tab

Changed the configuration according to andy

NOTE: Intellij Ultimate 2018.3. It will mark the Configuration as Invalid, but it works :)
I hope to help someone.
When you use PropertiesLauncher it sets up a class loader with the contents of the configured loader.path and then uses this class loader to load and call your application's main class. When you launch your application's main class directly in your IDE, PropertiesLauncher isn't involved so the loader.path system property has no effect.
It is possible to use PropertiesLauncher in your IDE but it'll require a bit of extra configuration. You'll need to configure a run configuration that has spring-boot-loader and your application on the classpath that launches PropertiesLauncher. You can then use the loader.main system property to tell PropertiesLauncher the name of your application's main class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With