将资源目录添加到greety的类路径(Gradle Plugin) [英] Adding a resource directory to classpath of greety (Gradle Plugin)
问题描述
我试图用插件 gretty
运行 gradle
,使用 jetty code>。问题是
gretty
插件确实在类路径中放置了目录
,我需要为 src / test / resources
Jetty
启动文件上的一些 .properties 文件设置一个延迟加载。
$ b
依赖关系{
grettycom.zaxxer:HikariCP:$ {version_hikaricp}
grettyorg.hsqldb:hsqldb:$ {version_hsqldb}
gretty文件(target / classes / main,target / resources / main,src / test / resources)
$ b $ p
$ b 上面的代码不会将资源加载到 classpath
由 gretty
插件使用。当我们运行 Jetty
时,我们可以将资源文件添加到 $ {JETTY_BASE} / resources
中,这些文件将存在于我们的 classpath
。任何想法/诀窍,以获得与 gretty
插件相同的功能?
解决方案我刚刚找到解决方案,查看 gretty
开放的问题。据作者称,这是一项尚未记录的功能。这是解决方案:
gretty {
classPath ['src / test / resources',' src / main / configs']
}
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 gretty
plugin?
解决方案 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']
}
这篇关于将资源目录添加到greety的类路径(Gradle Plugin)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!