Search code examples
mavengradletransitive-dependency

What is the maven equivalent of implementation dependencies in gradle?


I recently learned that gradle has api/implementation "scopes" for dependencies, and I was trying to figure out if there's a maven equivalent of the implementation in gradle. None of the maven dependency scopes seem exactly right for this - provided makes it not a runtime dependency, compile/runtime don't seem do the correct thing, ... and so it seems that there's not a direct equivalent.

Basically, I have a dependency of my library that is required at compile-time (for my library)/runtime (for code that uses my library), but I don't want to be in the compile classpath of code that depends on my library. Is this possible to do with maven?


Solution

  • AFAIK this is not possible.

    If you want to avoid unintentional use of transitive dependencies in your code, you can use dependency:analyse or dependency:analyze-only.

    The latter one allows you to fail the build if you directly use classes from transitive dependencies.