Script such as:

@Grab('org.apache.httpcomponents:fluent-hc:4.5.13')
import org.apache.http.client.fluent.Request

class GrabExample 

}

ivy is on the classpath.

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grabExample': Could not determine scripted object type for GroovyScriptFactory: script source locator [file:/scripts/GrabExample.groovy]; nested exception is org.springframework.scripting.ScriptCompilationException: Could not compile URL [file:/scripts/GrabExample.groovy]; nested exception is org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
GrabExample: 8: unable to resolve class org.apache.http.client.fluent.Request
 @ line 8, column 1.
   import org.apache.http.client.fluent.Request
   ^

1 error

    at org.springframework.scripting.support.ScriptFactoryPostProcessor.postProcessBeforeInstantiation(ScriptFactoryPostProcessor.java:330) ~[spring-context-5.2.7.RELEASE.jar!/:5.2.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInstantiation(AbstractAutowireCapableBeanFactory.java:1141) ~[spring-beans-5.2.7.RELEASE.jar!/:5.2.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.resolveBeforeInstantiation(AbstractAutowireCapableBeanFactory.java:1114) ~[spring-beans-5.2.7.RELEASE.jar!/:5.2.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:506) ~[spring-beans-5.2.7.RELEASE.jar!/:5.2.7.RELEASE]
    ... 23 common frames omitted
Caused by: org.springframework.scripting.ScriptCompilationException: Could not compile URL [file:/scripts/GrabExample.groovy]; nested exception is org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
GrabExample: 8: unable to resolve class org.apache.http.client.fluent.Request
 @ line 8, column 1.
   import org.apache.http.client.fluent.Request
   ^

1 error

    at org.springframework.scripting.groovy.GroovyScriptFactory.getScriptedObjectType(GroovyScriptFactory.java:297) ~[spring-context-5.2.7.RELEASE.jar!/:5.2.7.RELEASE]
    at org.springframework.scripting.support.ScriptFactoryPostProcessor.postProcessBeforeInstantiation(ScriptFactoryPostProcessor.java:323) ~[spring-context-5.2.7.RELEASE.jar!/:5.2.7.RELEASE]
    ... 26 common frames omitted
Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
GrabExample: 8: unable to resolve class org.apache.http.client.fluent.Request
 @ line 8, column 1.
   import org.apache.http.client.fluent.Request
   ^

1 error

    at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:295) ~[CamundaScriptingDelegatesProcessEnginePlugin.jar:na]
    at org.codehaus.groovy.control.CompilationUnit$ISourceUnitOperation.doPhaseOperation(CompilationUnit.java:914) ~[CamundaScriptingDelegatesProcessEnginePlugin.jar:na]
    at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:627) ~[CamundaScriptingDelegatesProcessEnginePlugin.jar:na]
    at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:389) ~[CamundaScriptingDelegatesProcessEnginePlugin.jar:na]
    at groovy.lang.GroovyClassLoader.lambda$parseClass$3(GroovyClassLoader.java:332) ~[CamundaScriptingDelegatesProcessEnginePlugin.jar:na]
    at org.codehaus.groovy.runtime.memoize.StampedCommonCache.compute(StampedCommonCache.java:163) ~[CamundaScriptingDelegatesProcessEnginePlugin.jar:na]
    at org.codehaus.groovy.runtime.memoize.StampedCommonCache.getAndPut(StampedCommonCache.java:154) ~[CamundaScriptingDelegatesProcessEnginePlugin.jar:na]
    at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:330) ~[CamundaScriptingDelegatesProcessEnginePlugin.jar:na]
    at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:314) ~[CamundaScriptingDelegatesProcessEnginePlugin.jar:na]
    at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:257) ~[CamundaScriptingDelegatesProcessEnginePlugin.jar:na]
    at org.springframework.scripting.groovy.GroovyScriptFactory.getScriptedObjectType(GroovyScriptFactory.java:278) ~[spring-context-5.2.7.RELEASE.jar!/:5.2.7.RELEASE]
    ... 27 common frames omitted

Appears to be related to how the scripts are "detected":

https://github.com/spring-projects/spring-framework/blob/master/spring-context/src/main/java/org/springframework/scripting/support/ScriptFactoryPostProcessor.java#L271

https://github.com/spring-projects/spring-framework/blob/master/spring-context/src/main/java/org/springframework/scripting/groovy/GroovyScriptFactory.java#L270

Comment From: StephenOTT

It seems to work running in a typical gradle run. But does not run as a fat jar.

Comment From: snicoll

Would you be able to share a small sample. You mentioned ivy on the classpath, so it would be better for us to be able to reproduce with the same environment.

Comment From: spring-projects-issues

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

Comment From: spring-projects-issues

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.