Skip to content

Group Maven dependencies: production dependencies and build / test dependencies #226

Open
@lolski

Description

@lolski

artifacts.bzl` declares what dependencies are allowed in a given repository and has allowed us to manage dependencies and versioning effectively.

Some dependencies declared there are only used in building and testing (eg., JUnit, Github library, Checkstyle, etc) whereas some others are used in production (ie., actually included in the distribution).

We should split the declaration in artifacts.bzl accordingly

  • production dependencies (for dependencies used in the distribution)
  • build dependencies (for dependencies used in build and test)

With this split, a library declared in production can be included in the distribution whereas a library declared in build cannot, and should only be used in assembly, deployment, or tests.

The workspace name for each dependencies should also clearly indicate whether they are production or a build dependency:

java_library(
  ...
  deps = [
    @production//google_or_tools
  ]
)

java_test(
  ...
  deps = [
    @build//junit_junit
  ]
)

We should also create a way to verify that there are no build dependency that is used in production:

bazel run //:dependency-test
ERROR: target //server:server depends on a build dependency '@build//junit_junit'

Being able to separate production and build dependencies will help us manage the dependency better - we can be strict in allowing what goes in production, while being more lenient for dependencies in build.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions