How do you configure GroovyConsole so I don't have to import libraries at startup?

前端 未结 5 1902
长发绾君心
长发绾君心 2021-02-06 04:44

I have a groovy script that uses a third party library. Each time I open the application and attempt to run my script I have to import the proper library.

I would lik

5条回答
  •  南方客
    南方客 (楼主)
    2021-02-06 05:29

    If you are on a Mac, I would highly recommend using SDKMAN to manage Groovy installations.

    Once installed via SDKMAN, you can modify ~/.sdkman/candidates/groovy/current/bin/groovy/conf/groovy-starter.conf. Packages you add here will be automatically imported at runtime whenever you start a Groovy Console session. You would want to add them under the section labelled in the example below:

        # load user specific libraries
        load !{user.home}/.groovy/lib/*.jar
        load !{user.home}/.groovy/lib/additional_package.jar
    

提交回复
热议问题