spring boot loading jars (application dependencies and external file system jars)

后端 未结 3 1114
傲寒
傲寒 2020-12-15 09:00

I am trying to figure out what is the best way to setup a spring boot application in such a way that its has its own jar dependencies but additional jars are added to classp

3条回答
  •  时光说笑
    2020-12-15 09:37

    thank you @Ashraf Sarhan, you rescue my two days :) I added in pom file:

             
                org.springframework.boot
                spring-boot-maven-plugin
                
                    ZIP
                    true
                    vn.com.Mymainclass
                    
                        
                            com.vn.groupId
                            excluded-id-a
                        
                        
                            com.vn.groupId
                            excluded-id-b
                        
                    
                
                
                    
                        
                            repackage
                        
                    
                
            
    

    And Placed ./lib folder containing two jars of two files which excluded above beside with my-main-spring-boot-app.jar file, and I ran:

    java -Dloader.path="lib/" -jar my-main-spring-boot-app.jar
    

    It worked perfectly.

提交回复
热议问题