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

前端 未结 5 1896
长发绾君心
长发绾君心 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:18

    At least on Linux groovy GroovyConsole is a Script has the Following command:

    startGroovy groovy.ui.Console "$@"
    

    startGroovy itself is a script which starts Java. Within the startGroovy script you should be able to modify your classpath and add the missing librarys.

    From startGroovy:

    startGroovy ( ) {
        CLASS=$1
        shift
        # Start the Profiler or the JVM
        if $useprofiler ; then
            runProfiler
        else
            exec "$JAVACMD" $JAVA_OPTS \
                -classpath "$STARTER_CLASSPATH" \
                -Dscript.name="$SCRIPT_PATH" \
                -Dprogram.name="$PROGNAME" \
                -Dgroovy.starter.conf="$GROOVY_CONF" \
                -Dgroovy.home="$GROOVY_HOME" \
                -Dtools.jar="$TOOLS_JAR" \
                $STARTER_MAIN_CLASS \
                --main $CLASS \
                --conf "$GROOVY_CONF" \
                --classpath "$CP" \
                "$@"
        fi
    

提交回复
热议问题