I have a project which has dependency A. Project is packing into WAR and dependency A - into jar. And another dependency B, which also depends on A. I want to pack project and when project B is packing it must rebuild its dependency A instead of getting compiled dependency. Please help, how can i achieve this
Asked
Active
Viewed 4.7k times
2 Answers
9
Always perform a clean when doing an install, ie mvn clean install
. This will make sure that all modules in the project are rebuilt, packaged, and installed in the local .m2 repository for inclusion by parent dependencies and projects.

jgifford25
- 2,164
- 1
- 14
- 17
-
Thanks, but module B is packing using assembly, I don't pack it on command line – jdevrr Dec 06 '10 at 15:11
-
@jdevrr What do you mean? You're using mvn assembly:assembly on the command line right? – Martijn Verburg Dec 06 '10 at 15:24
-
I use mvn package on the command line. And module B has assembly plugin inside – jdevrr Dec 06 '10 at 15:34
-
1@jdevrr: You have to use mvn install from the commmand line on module B. The package goal will not put the artifact in the correct location to be picked up by module A and then the project. You should edit your question including the maven assembly plugin information. I was wondering why you had that tag listed. – jgifford25 Dec 06 '10 at 16:23
-
are there anyway not to run install? will the maven auto compile the dependency and compile it? – gfan Jun 02 '16 at 07:28
4
What you may want is a multi-module project containing your three projects (WAR, A and B). Then you can run mvn package on the multi-module project and it will build and package all of the latest project code against each other without having to run mvn install to update the dependencies in your local repository first.

trask
- 621
- 1
- 6
- 9