user3714967
user3714967

Reputation: 1645

Maven combine two project

How can i combine two maven projects. One is webapp, and other is some javascript library (also webapp) which i want to combine 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.

Upvotes: 2

Views: 6747

Answers (3)

Balaji
Balaji

Reputation: 1019

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.org/plugins/maven-war-plugin/overlays.html

Upvotes: 0

Milkmaid
Milkmaid

Reputation: 1754

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

Upvotes: 0

Aaron Digulla
Aaron Digulla

Reputation: 328614

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.

Upvotes: 5

Related Questions