question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Documentation error - Enviroment Switching for Gradle

See original GitHub issue

In documentation https://github.com/intuit/karate#switching-the-environment

it configure gradlew enviroment variable using :

./gradlew test -Dkarate.env=e2e

but that dont work

image

The right way is :

command with -P

./gradlew test -Pkarate.env=e2e

and in build.gradle.tk (in my case) file :

systemProperties.set("karate.env", project.gradle.startParameter.projectProperties.get("env"))

i was 2 hours looking a workarround , if its only my case with kotlin, please make an annotation for some else

thanks!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
krstcscommented, Oct 29, 2020

Have you tried wrapping the -D options in quotes? I’m using the following and karate-config.js is picking up the -D options correctly.

gradle build -Plocal "-DfileLogLevel=info" "-DconsoleLogLevel=debug"

-Plocal is working as well, it’s project specific and makes my build use local maven dependencies (I use it to make sure my Karate wrapper works before pushing to AzureGit).

edit to add: My karate.log shows these two lines: 10:16:14.331 [Test worker] INFO com.intuit.karate - fileLogLevel system property was: info\n 10:16:14.332 [Test worker] INFO com.intuit.karate - consoleLogLevel system property was: debug

1reaction
krstcscommented, Oct 29, 2020

And, my karate-config.js (I use a karate-base.js so config is short): function fn() { var fileLogLevel = karate.properties['fileLogLevel']; var consoleLogLevel = karate.properties['consoleLogLevel']; karate.log('fileLogLevel system property was:', fileLogLevel); karate.log('consoleLogLevel system property was:', consoleLogLevel); }

EDIT: I HATE Github markdown!!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Enviroment Switching for Gradle · Issue #1355 · karatelabs ...
I'm using the following and karate-config.js is picking up the -D options correctly. gradle build -Plocal "-DfileLogLevel=info" "- ...
Read more >
Solving common problems - Gradle User Manual
Solving common problems · System file encoding · Environment variable tracking · Line endings · Symbolic links · Java version tracking · Avoid...
Read more >
Logging - Gradle User Manual
By default, Gradle redirects standard output to the QUIET log level and standard error to the ERROR level. This behavior is configurable. The...
Read more >
Upgrading your build from Gradle 7.x to the latest
Run gradle wrapper --gradle-version 7.6 to update the project to 7.6. Try to run the project and debug any errors using the Troubleshooting...
Read more >
Configuration cache - Gradle User Manual
The configuration cache is a feature that significantly improves build performance by caching the result of the configuration phase and reusing this for ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found