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
3 Answers
Reset to default 5Have 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