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

With libertyDev, project properties specified via -Px=y can't be used to resolve build gradle in child gradle invocation #791

Open
scottkurz opened this issue Jan 10, 2023 · 0 comments
Labels

Comments

@scottkurz
Copy link
Member

RECREATE

  1. Clone [email protected]:openliberty/guide-gradle-intro.git; cd guide-gradle-intro/finish
  2. Change the LGP version to use a variable substitution like:

classpath "io.openliberty.tools:liberty-gradle-plugin:$lgpv"f

  1. Do a successful non-dev mode command using a -P project prop:
    gradlew -Plgpv=3.4.1 libertyCreate
  2. Do a similar dev mode command using a -P project prop and see it fail:
    gradlew -Plgpv=3.4.1 libertyDev

NOTES

At first, I thought, from reading #607 and looking at the fix https://github.com/OpenLiberty/ci.gradle/blob/main/src/main/groovy/io/openliberty/tools/gradle/tasks/DevTask.groovy#L1197 that only liberty.runtime.* project properties were propagated to the child dev mode gradle invocation as -P project properties.

However, this doesn't explain the fact that this works:
gradlew -Pliberty.server.bootstrapProperties.abc=123 -Pliberty.server.var.xyz=456 libertyDev, even though it seems to me that the config file translation/copying happens within the child gradle execution (within the libertyCreate task impl that runs as part of libertyDev).

So there seems to be a different behavior between making the properties available for basic resolution/evaluation of the Gradle build file (I'm probably not using the precise terms) vs. having the properties available for task implementations.

WORKAROUND

  1. set the lgpv=3.4.1 in a gradle.properties file
  2. use the env var convention: ORG_GRADLE_PROJECT_lgpv=3.4.1 ./gradlew libertyDev
  3. The sysprop seems to get propagated too with: ./gradlew -Dorg.gradle.project.lgpv=3.4.1 libertyDev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant