Skip to content

[JENKINS-62961] incorrect "ERROR: Library blah expected to contain at least one of src or vars directories" message #383

@jenkins-infra-bot

Description

@jenkins-infra-bot

the message about no vars or src is incorrect.

it is shown if there is no src directory and there are no groovy files in the vars directory.

for example create a shared library containing just /vars/README.md and some files in /resources. if you try to load it you will get the error ERROR: Library blah expected to contain at least one of src or vars directories but there is a vars directory.

As can be seen in the code the error message does not match the check.

this causes confusion.

whilst I think the error message could be trivially changed I believe that the failure should be removed completely to allow a library with only resources (and not groovy).

current workaround for both issues is to create a file /vars/hackyWorkaround.groovy containing the following:

def call() {
    echo "WHY ARE YOU CALLING THIS FUNCTION!??!"
}


Originally reported by teilo, imported from: incorrect "ERROR: Library blah expected to contain at least one of src or vars directories" message
  • status: Open
  • priority: Minor
  • component(s): pipeline-groovy-lib-plugin, workflow-cps-global-lib-plugin
  • resolution: Unresolved
  • votes: 2
  • watchers: 3
  • imported: 20251212-090250
Raw content of original issue

the message about no vars or src is incorrect.

it is shown if there is no src directory and there are no groovy files in the vars directory.

for example create a shared library containing just /vars/README.md and some files in /resources. if you try to load it you will get the error ERROR: Library blah expected to contain at least one of src or vars directories but there is a vars directory.

As can be seen in the code the error message does not match the check.

this causes confusion.

whilst I think the error message could be trivially changed I believe that the failure should be removed completely to allow a library with only resources (and not groovy).

current workaround for both issues is to create a file /vars/hackyWorkaround.groovy containing the following:

def call() {
    echo "WHY ARE YOU CALLING THIS FUNCTION!??!"
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions