Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a project A (a webapp), depending on project B (B.jar) and this one depending on project C (C.jar).

I would like to create a maven goal named "Rebuild War", that clean all compiled code for these 3 projects and rebuild the whole in order to obtain a fresh War file.

I tried mvn clean package on project A, but I noticed that B and C are not recompiled. Indeed, B.jar and C.jar that are contained in local repository don't have a changing creation date.

Is there an adapted maven command for this requirement ?

share|improve this question
You didn't give your "anemic beans" question much of a chance, did you? 30 minutes is not very long to wait for an answer on the weekend. – Robert Harvey Apr 21 '12 at 22:49
up vote 3 down vote accepted

Given a directory structure of


you need to introduce


and that should specify A, B and C as modules. You can now do cd /foo; mvn clean install and have A, B, and C recompiled. If your dependencies are correct, they even do so in the correct order.

share|improve this answer
Thanks, that works well ! Your answer allowed me to read several articles about multiprojects module ;) – Mik378 Apr 15 '12 at 22:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.