How to make maven place all jars common to wars inside the same EAR to EAR root?

前端 未结 4 607
梦如初夏
梦如初夏 2020-12-12 18:18

We have a solution with numerous wars. Wars are similar in the sense they all use hibernate and spring. This means that we have a number of same jars inside each war. This i

4条回答
  •  长情又很酷
    2020-12-12 19:15

    Create a new artifact named commons-jars and package it as pom. It should depend on all the common jars you are using - Spring, Hibernate, Log4j, etc.

    Then, in each on your wars add it as dependency with scope "provided" (and don't forget to set the type as pom). You will be able to see it in your classpath but they won't be packaged into the war. This way you can also have war specific dependencies packaged into it, which the solution from skinny wars does not provide.

提交回复
热议问题