问题
I have a multi-module Maven project A. There are two modules: B and C, where C depends on B.
Let's say C is a web application, so by default B.jar would be included in the WEB-INF/lib directory of C.
But instead of this, I want to compile B, and then move its compiled classes to the target directory of C.
How can I achieve this in Maven?
Thank you for your answers,
balázs
回答1:
If your module B is also a webapp module, you can create a jar file containing only the classes simply by configuring the war plugin. You can then make C depend on that -classes artifact by adding <classifier>classes</classifier> to the pom.
Otherwise you can use the dependency plugin to unpack the B artifact when C is packaged.
来源:https://stackoverflow.com/questions/6373534/maven-depend-on-project-no-jar-but-classes