@Grape in scripts with multiple files

I would like to use @Grape in my groovy program, but my program consists of several files. The examples on the Groovy Grape page all seem to assume that your script will consist of a single file. How can i do this? Should I just add it to one of the files and expect the import to work from others? If so, are all @Grape calls common in one file without other code? Do I need to add a Grape call to all the files that will import the package? Do I need to load a JAR and create a Gradle file that I clean without it?

+5
source share
2 answers

The graphics engine and @grab annotation were created as part of the groovy kernel with single file scripts to allow a piece of text to easily become a fully functional program.

for large applications, gradle is a terrific build tool with many useful features.

but yes, you can manage all the dependencies of the application only with grapes.
regardless of whether you comment on each file or not, just make sure that the annotated @grab file is read before trying to use an external class.
a core class note is probably better since you will easily lose the library version if you have annotations scattered around.

, gradle , .

+4

-, , ...

, , , @Grab, script, .

, , Gradle ( ), , .

-, ( , )

-, Gradle , like codenarc, . ( ), , , , .

+1

All Articles