Skip to content

When getting started with the JVM, it's not obvious how/when to create your intial lockfile #17521

Open
@stuhood

Description

@stuhood

To create a lockfile for the JVM, you need to run ./pants generate-lockfiles. But if you haven't done that, and have redefined the lockfile location, you will get a unmatched globs warning instead:

10:14:46.00 [ERROR] 1 Exception encountered:

  Exception: Unmatched glob from The resolve `jvm-default` from `[jvm].resolves`: "lib/3rdparty/jvm/default.lock"

Do the file(s) exist? If so, check if the file(s) are in your `.gitignore` or the global `pants_ignore` option, which may result in Pants not being able to see the file(s) even though they exist on disk. Refer to https://www.pantsbuild.org/v2.14/docs/troubleshooting#pants-cannot-find-a-file-in-your-project.

Rather than an unmatched glob, we should instead detect the missing file at a higher level, and explain how to create the lockfile. It looks like we already attempt to do that (in some cases):

lockfile_snapshot = await Get(Snapshot, PathGlobs([lockfile_req.read_lockfile_dest]))
if not lockfile_snapshot.files:
raise ValueError(
f"No lockfile found at {lockfile_req.read_lockfile_dest}, which is configured "
f"by the option {lockfile_req.lockfile_option_name}."
f"Run {regen_command} to generate it."
)

... but apparently not in others.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions