Create a single executable JAR from a Spring Based Java Application

前端 未结 4 1367
攒了一身酷
攒了一身酷 2020-12-30 10:22

I have a spring based application that does a component/package scan looking for packages within a certain namespace. The application runs perfectly in Eclipse and I\'d like

4条回答
  •  清酒与你
    2020-12-30 11:00

    I just had the very same problem than you today, with doing exactly the same steps :)

    So thanks for your message, it makes me save some time and besides, i just want to quickly answer to your "Why it worked is still a mystery." sentence :

    "This is because I have several Spring Jar in my dependencies. Some of the spring jars contain meta info files with the same name. To avoid that some meta files are overridden you have to merge it"

    So this is why you need to add those two transformers to the maven snippet given into the Maven Shade Plugin documentation :

    META-INF/spring.handlers
    
    META-INF/spring.schemas
    

    source : http://robert-reiz.com/2011/11/14/832/

    Hope it helps for understanding ;)

提交回复
热议问题