This approach may work well for simple file include but if I have packages (and import statements, which is inevitable if program grows) it does not compile.
Andriy On Wed, Mar 9, 2022 at 4:47 AM Jochen Theodorou <blackd...@gmx.org> wrote: > On 08.03.22 19:08, Andriy Rysin wrote: > > So it looks like groovy picks up groovy scripts from the current > > directory by default. > > So the users can't just do "/path/to/scripts/TagText.groovy <myfile>" > > any more. > > They would have to do: > > cd /path/to/scripts/ > > ./TagText.groovy <myfile> > > > > or they would have to invoke groovy explicitly: > > groovy -cp /path/to/scripts /path/to/scripts/TagText.groovy <myfile> > > what you could also do is to make something like a small loader. Use > > https://docs.groovy-lang.org/latest/html/gapi/groovy/transform/SourceURI.html > to get the uri of the file, then add the to the classloader to then > finally load the class that is really doing the work and has > dependencies on other scripts. This loader should not have any direct > source dependencies for this to work. > > bye Jochen > >