Reputation: 165
I'm working on building what is effectively a throwaway Spring Boot application. Using the CLI, I can get a basic page up and working (see https://spring.io/guides/gs/spring-boot/). What I haven't figured out how to do, however, is how I can add external dependencies (ie. third-party JAR files) to the compile or runtime classpath when I use either the "spring run" or "spring jar" commands. Note that these external dependencies are local to my computer and are not stored in an artifact repository. Is there a simple way to do this?
Upvotes: 0
Views: 675
Reputation: 116091
If the jars aren't in an artifact repository, the easiest way to add them to the classpath is to use -cp
when running your app or creating its jar.
For example:
spring run -cp foo.jar app.groovy
Or:
spring jar -cp foo.jar app.jar app.groovy
In the spring jar
case, anything that's added to the classpath using -cp
will be packaged inside the resulting jar (app.jar in this case) ensuring that it's self-contained.
Upvotes: 3