At runtime, everyone everywhere needs multiple versions of the same jar
at runtime, but this may need may not be possible (maybe OSGi addresses
this).
If you start out with the basics like Spring/Hibernate, you will get two
versions of log4j downloaded as transitive dependencies.
It is not exactly safe to substitute one jar for the other or to expect
backwards compatibility. It would be ideal if this were the case, but
unfortunately cannot be controlled by the end user. It is unfortunate
that two method calls have the same signature in different releases but
have different functionality entirely, but it happens. There are some
projects that try harder at this and some that simply do not care.
The only thing you can say across the board is that at runtime, you
should have in the classpath the transitive dependencies of the line of
code that is being executed. I am not sure if this is entirely possible.
J.V.
On 4/27/2012 12:53 PM, Daniel Serodio wrote:
For webapps, Maven is completely out of the picture at runtime. If
you're running a (console) app from within the project folder - i.e.
you have the pom.xml - you may use the Exec Maven Plugin:
http://mojo.codehaus.org/exec-maven-plugin/java-mojo.html
But in any case, you shouldn't have two different versions of a
library (like log4j). I you really, really need two different versions
of a library, the Shade plugin may help, as its able to rename a
package so you can refer to these different versions separately.
HTH,
Daniel Serodio
J.V. wrote:
I understand how Maven resolves dependencies (and transitive
dependencies) at compile time, but does it bring anything to the
table at run time?
For example, if I have in my application dependency list two versions
of log4J (let's say version 8 and version 15), will I deploy both
jars/version along with my app on say a tomcat server inside the war?
At runtime which one does it choose? If I am executing the code that
depends on version 8, how would the correct jar be in the classpath
at that point and later log4J version 15 be in my classpath when code
that has that dependency executes?
At runtime, Maven is out of the picture correct? This is a missing
piece for me.
thanks
J.V.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]