最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

java - Maven combine two project - Stack Overflow

programmeradmin4浏览0评论

How can i bine two maven projects. One is webapp, and other is some javascript library (also webapp) which i want to bine with others project.

Or, would be better, how to add some outside folder with js files to maven project that can be deployed on testing server and then build to war.

How can i bine two maven projects. One is webapp, and other is some javascript library (also webapp) which i want to bine with others project.

Or, would be better, how to add some outside folder with js files to maven project that can be deployed on testing server and then build to war.

Share Improve this question asked Dec 8, 2014 at 10:54 user3714967user3714967 1,6453 gold badges16 silver badges33 bronze badges 1
  • From my point of view JS are considered as resources and it should go along with project it self, if you want to have different JS to bundled with war then you should use profile in maven for the same. – Bilbo Baggins Commented Dec 8, 2014 at 10:58
Add a ment  | 

3 Answers 3

Reset to default 5

Have a look at overlays in the Maven WAR Plugin documentation. This explains how Maven merges resources from different web projects into a single WAR.

In a nutshell, you create several WAR files of all the dependencies (usually, you already have this but you can even do this if they aren't real working web projects). Then you can pull these in as dependencies. The important part here is to specify the type of the dependency (<type>war</type>); otherwise Maven will try to add the JAR.

The WAR plugin will notice the additional WARs in the list of dependencies and merge them.

You can create One parent project and Two modul project. You will have 3 pom.xml files. modul projects extendens dependencies from parent project. Maven parent pom vs modules pom, Multimodule project

Maven WAR Overlays could solve the problem. If you have two maven web projects, and one of your Web Project depends on the other's you could declare the dependent project as a dependency and do an overlay.

Reference:

http://maven.apache/plugins/maven-war-plugin/overlays.html

发布评论

评论列表(0)

  1. 暂无评论