Reputation: 15792
I have maven project with next modules: app
, app-impl
, web
. I build web with maven-war-plugin. Now app-impl
depends on app
. web
depends on app-impl
.
But web
should depends only on app
. By some magic maven-war-plugin should include app-impl
in war. Could I do it without additional maven module?
Upvotes: 0
Views: 81
Reputation: 7980
I absolutely agree with @Torsten, but maybe there is something valid in your request:
when using IDE to develop the project, you can require it to stop offering your implementation classes in code completion lists.
If this is your reason, just add both dependencies, and for the implementation one, specify <scope>runtime</scope>
.
This ensures that:
app
module get to classpath of javac, but app-impl
does notapp
and app-impl
will be placed under WEB-INF/lib/
in your warapp-impl
This definitely does not save you keystrokes, but gives you a better pom, carefully modelling the reality.
Upvotes: 2
Reputation: 6204
IMHO having a dependency on app
in web
does not reflect the reality, as your web-application really depends on having an implementation of the interfaces I assume you have defined in app
.
Consider having an alternative implementation in lets say app-impl2
. How can maven possibly decide which implementation it should choose?
So having web depend on app-impl is to me the way to go and given the above setup also should work out of the box.
Upvotes: 2