Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradle scaffolding doesn't properly detect app type if dependencies are declared as variables instead of strings #3982

Open
mcanalesmayo opened this issue Jun 17, 2021 · 0 comments

Comments

@mcanalesmayo
Copy link

Assume we have a project with a structure like in this Gradle example where we have a buildSrc folder which contains a Libraries class defining common dependencies that can be used in several subprojects. In the subprojects, we would declare those dependencies as follows:

dependencies {
  ...
  implementation Libraries.springboot
  ...
}

Then Habitat would not detect springboot as app type.

This is because Habitat is using a string search of "^[^/].*org.springframework.boot:spring-boot" in the build.gradle file: https://github.com/habitat-sh/core-plans/blob/master/scaffolding-gradle/lib/scaffolding.sh#L342

_detect_springboot_app() {
  if [[ -f build.gradle ]] \
      && grep -q "^[^/].*org.springframework.boot:spring-boot" build.gradle; then
    build_line "Detected Spring Boot app type"
    _app_type="springboot"
    return 0
  else
    return 1
  fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant