Hi,
I would like to have your advice for this problem.
Context:
------------
I have a multi-modules project :
project
|
|---- earModule (depends on warModule, apiJarModule, implJarModule)
|
|---- warModule (depends on apiJar, apiJarModule, implJarModule,
mockImplJarModule and spring)
|
|--- apiJarModule
|
|--- implJarModule (depends on apiJar)
|
|--- mockImplJarModule (depends on apiJar)
I want to declare for my warModule:
- apiJarModule for compile, runtime, test and packaging => scope
compile
- implJarModule only for runtime (declared in a spring context
descriptor), not for compile, test and packaging => scope ?
(provided,runtime, ?)
- mockImplJarModule only for test (declared in a spring context
descriptor), not for compile, runtime and packaging => scope test
I want to declare for my earModule:
- warModule with a scope compile
- implJarModule with a scope runtime
Problem:
-------------
For my warModule, I use for the moment the scope provided for the
implJarModule dependency.
But it's not really what I want because I want to say that I need this
dependency only for runtime.
- if I use the scope runtime, my war will include my implJarModule
dependency in its packaging. But it's not what I want because I want that
dependency to be included in my ear and not in my war. If I want to exclude
the dependency with the maven-war-plugin, I have to use the provided scope
(cf. [2]).
- if I use the scope provided, it's not also exactly correct because this
dependency is not needed for the compilation.
- I don't think also that optional is the solution because my warModule
has to inform that it need this dependency in runtime (declared in a spring
context descriptor). It's not the semantic of optional (cf. [1]).
I did not found a good solution for the moment.
I need the runtime scope but not transitive (like a mix of runtime and
provided scope).
But I don't know how to do this...
What do you think about it ?
Rémy
[1]
http://www.nabble.com/dependencies-are-bloated-in-M2-tf3182336s177.html#a8831892
[2]
http://maven.apache.org/plugins/maven-war-plugin/faq.html#transitiveexclude