这应该可以,但是我目前可能不知道有一种更简单的方法。
基本上,它检索SCM插件返回的完整URL,将其分割
/并提取所需的部分。
def repoUrl = checkout(scm).GIT_URLdef key = repoUrl.tokenize('/')[3]def slug = repoUrl.tokenize('/')[4]slug = slug.substring(0, slug.lastIndexOf('.')) //Remove .gitecho "The projectKey is: ${key}"echo "The repositorySlug is: ${slug}"


