With the solution that I suggested, A depends on C which is a provided
POM so that you can swap versions of libjar to build your fat jar.
Essentially you are lying to A by making it think that C is one thing
not knowing that you will swap C's dependency on libjar later on while
building the fat
You are looking for the impossible.
You want A to work with any version of libjar
You want B to use A but not know which version of libjar the A it is using
depends on... actually to be independent of the version of libjar that A
depends on... but also to bundle the specific one...
Rethink what
Actually, I think it is possible, though probably could not be done by current
Maven implementation. As long as B can know which libjar the shim A is built
upon. I am saying that it is possible is because that I can achieve the goal
with SBT, when sbt do publish local, it will fill the profile
Using profiles to manipulate dependencies is a route to madness.
An modules dependencies should be a constant... It was a mistake to allow
dependencies within profile.
The correct solution is to create additional modules that aggregate in the
corresponding lib versions (this is also a bad plan,
Thanks Stephen
I see your solution is let B manage the libjar version. While this is
against my wish, I wish B to know nothing about A's internal implementation. In
the future, A might depends on a v3.0 libjar, I do wish to just repackage B to
make it work not revise B's code or
B depends on A
A depends on C
C depends on libjar x.0 provided
C has no code and is only a pom not a jar.
You can then swap in any compatible version of libjar by providing it at
run-time.
Still not sure why you can not just use the latest version of libjar if
any version will work at
Well. The reason for using different version of libjar is that it's a client
API, and working with different version of server counter part code.
They are not compatible, instead, A is a shim layer that hook into different
libjar API and provide a common interface for B to use. So that to hide
A has code
C has no code and is there to allow you to compile A and B with libjar
without getting libjar into your A jar.
provided is there to tell maven not to put libjar into A.
It says that you will do that after A is built and before B is executed.
You then assemble a deliverable jar with
Hi
I have a project with module A that will be built with or without profile say
-Pnewlib , thus I can have it build with different version of library
dependency let's say by default use libjar-1.0 and when -Pnewlib will use
libjar-2.0.
Then, I have a module B to depends on module A. The