Adding a resource directory to classpath of greety

2019-07-17 14:56发布

I'm trying to run gradle with the plugin gretty using jetty. The problem is the gretty plugin does put the directory src/test/resources on the classpath and I need a lazy load for some .properties files on the Jetty startup.

dependencies {
    gretty "com.zaxxer:HikariCP:${version_hikaricp}"
    gretty "org.hsqldb:hsqldb:${version_hsqldb}"
    gretty files("target/classes/main", "target/resources/main", "src/test/resources")
}

The code above is not loading the resources to the classpath to be used by the gretty plugin. When we run Jetty we can add our resource files on ${JETTY_BASE}/resources and those files will be present in our classpath. Any idea/trick to get the same feature with grettyplugin?

1条回答
闹够了就滚
2楼-- · 2019-07-17 15:23

I just found the solution looking into the gretty opened issues. According to the author, this is a feature not documented yet. Here is the solution:

 gretty {
     classPath ['src/test/resources', 'src/main/configs']
 }
查看更多
登录 后发表回答