Scenario:
- A gradle project, using the
org.jetbrains.kotlin.jvm
plugin - The project has some
*.kts
kotlin script files located insidesrc/main/kotlin
. The scripts do various tasks, for instance there is a script for loading test data from a set of CSV files into a local H2 database, a script for creating a test user in the database etc. - I currently run these scripts using IntelliJ IDEA run configurations
- The gradle build file is using kotlinscript (
build.gradle.kts
)
To make things easier to set up for new developers, I would like to configure gradle so I can run the scripts directly using gradle. That would simplify my README.md
, instead of "use IntelliJ to execute the script xxx.kts with arguments yyy and zzz, then nnn.kts", I could write "execute gradle loadTestDataIntoLocalH2Database".
Questions/issues:
- Is there a simple way to execute a
*.kts
script from gradle?