Hi, how i can use the gradle scripting plugin? my ...
# scripting
s
Hi, how i can use the gradle scripting plugin? my script is not in the source folder
i
Sorry, I do not understand the question. If you want IDEA to recognize your script that located outside of the source roots, you need to have a plugin, that will provide idea with the script definition, or, as a fallback - specify `Script template classes`/`Script templates classpath` in kotlin compiler settings in IDEA.
s
yes, i want that I find in the gradle plugin repo the plugin
org.jetbrains.kotlin.plugin.scripting
, i want know too if this plugin is for this use case
sorry, my mistake, the IDEA recognize by the file extension of the script definition, but how i make the IDEA recognize? this gradle plugin can i use to tell where is the script definition class?
i
The gradle plugin has nothing to do with IDEA, and even in gradle this plugin will only work for scripts in the source sets (source roots in IDEA’s terms). So, if your scripts is a part of your sources then you can simply add the jar with definition and discovery files to dependencies and it will work in gradle and in IDEA. If it is not a part of your sources, then you probably handle it somewhat separately and do not compile with gradle at all. In this case you either need a dedicated IDEA plugin/extension for that, or you can, as a fallback, add your definition jar to the
Script templates classpath
in kotlin compiler settings in IDEA and put definitions FQN to
Script template classes
there as well.
❤️ 1