Gradle task check if property is defined

if (project.hasProperty(‘special’)) should do it. Note that what you’re doing to select a testng suite won’t work, AFAIK: the test task doesn’t have any test() method. Refer to https://discuss.gradle.org/t/how-to-run-acceptance-tests-with-testng-from-gradle/4107 for a working example: test { useTestNG { suites ‘src/main/resources/testng.xml’ } }

Gradle build errors after updating Android Studio

Try adding a new file in the root of your project called “local.properties” (or modify the existing one). It should contain sdk.dir= followed by the path to the sdk location, in my case sdk.dir=/Applications/Android Studio.app/sdk I think Android Studio normally creates one automatically but says that it shouldn’t be added to VCS. I put it … Read more

Gradle Kotlin DSL: Define Kotlin version in unique place

In later versions of Gradle you no longer need to specify the version of your kotlin(stdlib|reflect|test) dependencies, the Kotlin plugin will automatically configure them for you. As for extracting the dependency to a single place, there are two main patterns: define the constants you want to share in an object within buildSrc/src/main/kotlin/ and use that … Read more

Execute gradle task on sub projects

Not entirely sure which of these you’re after, but they should cover your bases. 1. Calling the tasks directly You should just be able to call gradle :other/projC:hello :other/projD:hello I tested this with: # Root/build.gradle allprojects { task hello << { task -> println “$task.project.name” } } and # Root/settings.gradle include ‘projA’ include ‘projB’ include … Read more