groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Wagenleitner <john.wagenleit...@gmail.com>
Subject Re: ConfigSlurper not finding Config.groovy in jar
Date Fri, 15 Apr 2016 17:25:44 GMT
If the build is compiling the file you probably either need to copy it into
your jar from another location or you might be able to use the
#parse(Class) method of ConfigSlurper.

def config = new ConfigSlurper().parse(Config)

On Fri, Apr 15, 2016 at 9:07 AM, Guy Matz <guymatz@gmail.com> wrote:

> Hi!  I can't seem to find and slurp in a config file that's contained in a
> jar.  I think part of the problem may be that the config.groovy file is
> being compiled into a class, but can't figure out the right way to go about
> slurping it in . . .   from an ancient post I have the following code:
>
> def InputStream is = getClass().getResourceAsStream('/Config.groovy')
> def config = new ConfigSlurper().parse(is.getText())
>
> The getClass()...   return null.
>
> My directory structure is:
>
> src/main/resources/Config.groovy
>
> however my jar looks contains Config.class
>
>
> Anyone know what I'm doing wrong here?
>
> Thanks a lot!
>
> Guy
>
>
>

Mime
View raw message