Documentation error - Enviroment Switching for Gradle
See original GitHub issueIn documentation https://github.com/intuit/karate#switching-the-environment
it configure gradlew enviroment variable using :
./gradlew test -Dkarate.env=e2e
but that dont work
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:
- Created 3 years ago
- Comments:8 (3 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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
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!!