0

I need to create a dependent maven project. The child one should be a jar, that would be called by the parent project which should be a war file. The steps should be like this. When I build the war, it should automatically build the jar file and include it and build the war and show output of the child jar (suppose a simple print statement).

Note: Build should be done only once and that is for building the final war. Need to edit the pom.xml accordingly.

I am new to maven,so a bit elaborate solution would be very helpful.

  • 1
    Have you looked into "Maven modules" at all? What you want is a project with two modules, the war module depending on the jar module. – Boj Apr 22 '14 at 04:42
  • No, can you please suggest a good read about it? @Will – Aniruddha Apr 22 '14 at 05:47
  • Here's an example (I just Googled, nothing else). http://books.sonatype.com/mvnex-book/reference/multimodule-sect-simple-web.html – Boj Apr 22 '14 at 09:04
  • There's a lot of way you can configure yout project layout, but in your case i suggest to create a parent type pom, con childs module (the war one, the jar one, and others you want) this structure is recommended if you use the war project as UI container... This could help you too ---> http://stackoverflow.com/questions/7897114/how-to-assemble-multimodule-maven-project-into-one-war – ivoruJavaBoy Apr 22 '14 at 09:20

0 Answers0