添加使用摇篮的应用插件类路径条目 [英] Adding classpath entries using Gradle's Application plugin
问题描述
我用摇篮的应用插件生成安装了一个独立的Java应用程序。我有一个配置文件,我需要把在类路径上,但我似乎无法得到它的SH /批处理文件正确生成的类路径。这个配置文件需要被位于罐子以外
I'm using Gradle's Application plugin to generate the install for a standalone java application. I have a configuration file I need to put on the classpath but I can't seem to get it to generate the classpath correctly in the sh/bat files. This configuration file needs to be located outside of the jar.
conf文件所在的目录 / src目录/距离/ conf目录/
所以当我运行 installApp
它安装像这样一个conf目录下的 $ APP_HOME / conf目录
。
The conf file is in the directory /src/dist/conf/
so when I run installApp
it installs it under a conf directory like this $APP_HOME/conf
.
我试过这个目录中增加了这样的claspath:
I tried adding this directory to the claspath like this:
startScripts.classpath.add(files('$APP_HOME/conf'))
但是当我看到在SH / BAT文件的classpath它增加了,看起来像这样的条目:
but when I look at the classpath in the sh/bat files it adds an entry that looks like this:
$APP_HOME/lib/conf
我如何告诉gradle这个砸 LIB
部分为这个项目吗?
推荐答案
在我看来,这就是我要做的不应该是远远不寻常的,但作为一个解决办法,我可以有 DIST
目录的src /距离/ lib中/ conf目录
允许 CONF
目录放置在 LIB
目录以及产生的gradle为SH /批处理文件是正确的类路径。
It seems to me that what I'm trying to do shouldn't be that far out of the ordinary, but as a workaround I can have the dist
directory be src/dist/lib/conf
which allows the conf
directory to be placed in the lib
directory and the classpath that gradle generates for the sh/bat files to be correct.
我会接受另外一个答案,如果有人有一个更好的。
I'll accept another answer if someone has a better one.
这篇关于添加使用摇篮的应用插件类路径条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!