maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Taddiken <simon.taddi...@gmail.com>
Subject Maven adjusts transitive compile-scope dependency to test-scope
Date Tue, 14 May 2019 19:40:28 GMT
Hi everyone,

I've encountered the following behavior and I'm not quite sure whether it
is desirable.
In my project, I have declared a dependency *X* with scope *test*. I then
updated the version of a 3rd party dependency *Y*. In its new version, *Y*
suddenly requires the aforementioned dependency *X* as a *compile *scoped
dependency.

In this scenario, maven resolves the scope of *X* to be *test, *although it
is now required by *Y* during runtime, causing ClassNotFoundExceptions. By
the very nature of this behavior those mistakes can't even be detected in
unit tests because *X* is available on test classpath.

I have just found out that this behavior seems to be intended (
https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope)
but I can't really come up with a rationale for this design. Managing any
transitive compile scoped dependency down to test scope will almost
certainly cause ClassNotFoundExceptions during runtime.

Thoughts?

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message