bazel-contrib / bazel-contrib/rules_jvm_external

How to declare `testonly` with `bzlmod` ?

Open
#906 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
373
Forks
301
Avg merge
7d 17h
Merged PRs (30d)
3

Description

In the context of https://github.com/enola-dev/enola/issues/206, I would like to use the testonly support introduced in #346 by @Yannic and @jin.

https://github.com/bazelbuild/rules_jvm_external#test-only-dependencies documents how to use it, but in my project I'm using the (new) https://github.com/bazelbuild/rules_jvm_external/blob/master/docs/bzlmod.md approach.

I have tried using it but it fails like this, see this build log:

ERROR: Traceback (most recent call last):
        File "<root>/MODULE.bazel", line 24, column 23, in <toplevel>
Error in call: call() got unexpected positional argument
ERROR: Error computing the main repository mapping: error executing MODULE.bazel file for <root>

How does one use testonly in a MODULE.bazel?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Compare the test-only dependencies guidance in the linked rules_jvm_external documentation with the bzlmod example in docs/bzlmod.md. Reproduce the failure from MODULE.bazel using the linked build log and PR #208, then document a working testonly declaration for that module setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.