[jira] [Updated] (GROOVY-8792) groovy-json not working from <groovy> Ant task

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (GROOVY-8792) groovy-json not working from <groovy> Ant task

JIRA jira@apache.org

     [ https://issues.apache.org/jira/browse/GROOVY-8792?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gregory Moltchadski updated GROOVY-8792:
----------------------------------------
    Labels: ant json  (was: )

> groovy-json not working from <groovy> Ant task
> ----------------------------------------------
>
>                 Key: GROOVY-8792
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8792
>             Project: Groovy
>          Issue Type: Bug
>          Components: Ant integration, JSON
>    Affects Versions: 2.5.0
>            Reporter: Gregory Moltchadski
>            Priority: Major
>              Labels: ant, json
>         Attachments: testsuite.7z
>
>
> groovy-json 2.5.X uses java.util.ServiceLoader to load FastStringService and therefore doesn't work in a multi-classloader environment
> build.xml
> {code:xml}
> <project name="test" default="build" basedir=".">
>   <taskdef name="groovy"
>            classname="org.codehaus.groovy.ant.Groovy"
>            classpath="groovy-2.5.2.jar:groovy-ant-2.5.2.jar:groovy-json-2.5.2.jar"/>
>   <target name="build">
>     <groovy>
>     <![CDATA[
>       import groovy.json.*
>       def json = new JsonSlurper().parseText('{"person":{"name":"Guillaume","age":33,"pets":["dog","cat"]}}')
>       println new JsonBuilder(json).toPrettyString()
>     ]]>
>     </groovy>
>   </target>
>  
> </project>
> {code}
> Build output:
> {code:xml}
> BUILD FAILED
> C:\test2\build.xml:8: java.lang.RuntimeException: Unable to load FastStringService
>         at org.apache.groovy.json.internal.FastStringUtils.getService(FastStringUtils.java:57)
>         at org.apache.groovy.json.internal.FastStringUtils.toCharArray(FastStringUtils.java:67)
>         at org.apache.groovy.json.internal.BaseJsonParser.parse(BaseJsonParser.java:112)
>         at groovy.json.JsonSlurper.parseText(JsonSlurper.java:205)
>         at groovy.json.JsonSlurper$parseText.call(Unknown Source)
>         at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
>         at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
>         at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128)
>         at embedded_script_in_C__test2_build_dot_xml.run(embedded_script_in_C__test2_build_dot_xml:2)
>         at org.codehaus.groovy.ant.Groovy.parseAndRunScript(Groovy.java:517)
>         at org.codehaus.groovy.ant.Groovy.execGroovy(Groovy.java:464)
>         at org.codehaus.groovy.ant.Groovy.execute(Groovy.java:322)
>         at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>         at java.lang.reflect.Method.invoke(Unknown Source)
>         at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
>         at org.apache.tools.ant.Task.perform(Task.java:348)
>         at org.apache.tools.ant.Target.execute(Target.java:435)
>         at org.apache.tools.ant.Target.performTasks(Target.java:456)
>         at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
>         at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
>         at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
>         at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
>         at org.apache.tools.ant.Main.runBuild(Main.java:851)
>         at org.apache.tools.ant.Main.startAnt(Main.java:235)
>         at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
>         at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)