We are planning to implement parallel execution of bdds for single gradle project, i have added below line to build.gradle
getting below error.
//Enable parallel execution for all tasks
gradle.startParameter.parallel = true
// Maximum number of threads
gradle.startParameter.maxParallelForks = 1
No such property: parallel for class: org.gradle.api.internal.StartParameterInternal
To start with, I’d recommend switching to Kotlin DSL. This immediately makes your build scripts type-safe, produces actually helpful error messages in case you mess up syntax, and provides amazingly better IDE support when using a proper IDE like IntelliJ IDEA.
As the error tells you, there is no property called
parallel in the start parameters object. There is
parallelProjectExecutionEnabled which is the code representation of
--parallel. But I doubt you want to set that. On the one hand I think it is too late to set that from the build script it would not have any effect anyway. And on the other hand, it will most probably not have the intended effect anyway. This is also shown by you setting
maxParallelForks which you would get a complaint about next as it also does not exist.
You probably wanted to configure the
test task instead.
Besides that with
maxParallelForks nothing is done in parallel anyway.
Also, if you use a test framework that supports parallel test execution built-in like JUnit Jupiter or the Spock framework (very much can recommend that), I advise to consider using that facility instead as it can run tests in parallel much more efficiently, as long as your tests are safe to be run in parallel or guarded accordingly.
Thanks for your kind reply, how we can run two independent tasks parallelly in single gradle project.
Only if you make your build compatible with configuration cache and enable configuration cache: Configuration cache
Configuration cache enables all non-related tasks in all projects to run in parallel, while
--parallel (or its according Gradle property) only allows tasks in different projects to run in parallel.