How to specify an additional class path on the command line when starting Spring Application boot through Maven?

I am running an application (on GitBash for Windows) using

mvn spring-boot:run 

Except that the application is looking for a properties file that I would like to make available in the classpath. But I do not want to change the code in this application.

Is there a way to specify additional class paths when running this command? I tried various forms:

mvn spring-boot:run -Dclasspath="C:\\path\\to\\config\\dir"

or

mvn spring-boot:run -Dclasspath=/C/path/to/config/dir

And I tried to install $CLASSPATH.

None of this works, but I don’t understand where this is happening, because the only error is that my properties file was not found.

+4
source share

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


All Articles