spring-projects / spring-plugin

Apache License 2.0
441 stars 117 forks source link

How to use external jar in springboot project #73

Open darkman97i opened 4 years ago

darkman97i commented 4 years ago

Hi,

I have a spring boot project what is using spring-plugin, my project is named springboot-sample ( it builds a springboot-sample.war ). My plugins code are in a external project, what build a jar file ( okm-spring-plugins-0.0.1-SNAPSHOT.jar ).

Currently, if I add in my spring boot project (war file ) the next dependency, I get it working:

....
<dependency>
<groupId>com.test</groupId>
<artifactId>okm-spring-plugins</artifactId>
<version>0.0.1-SNAPSHOT</version>
<scope>system</scope>
<systemPath>/software/git/test-spring-plugin/okm-spring-plugins/target/okm-spring-plugins-0.0.1-SNAPSHOT.jar</systemPath>
</dependency>
...

I have tried to remove the dependency and set the plugin's jar from the command line:

java -jar springboot-sample.war -classpath /software/git/test-spring-plugin/okm-spring-plugins/target/

But seems is not working, any suggestion will be appreciated.

Thanks for your time.

LitschiW commented 11 months ago

Hi, I know this question is quite old by now, but are there any updates on this?

darkman97i commented 11 months ago

In my case I solved using jspf what allows to load plugins looking at the whole project based on annotations and from external folders: https://mvnrepository.com/artifact/jspf/core/1.0.2