Adding a resource directory to classpath of greety (Gradle Plugin)

前提是你 提交于 2019-12-11 00:09:35

问题


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:


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']
 }


来源:https://stackoverflow.com/questions/39177905/adding-a-resource-directory-to-classpath-of-greety-gradle-plugin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!