我的应用程序要求当它在目录下查找配置文件时,类路径上必须有一个\config
目录可用。我目前已经按照以下方式配置依赖项,但这可能不是将目录提供给我的应用程序的正确方法:
dependencies {
... //runtime, compile dependencies pulled from repositories
runtime files('config')
}
我正在使用 application
插件为我的项目创建独立的 zip 包。如果我的 \config
目录下还有 \config\subdir
、file1
和 file2
,那么该插件会生成一个 build\install
目录,并具有以下结构:
| build
| --|install
| ----|bin
| ------ projectName
| ------ projectName.bat
| ----|lib
| ------ dependency1.jar
| ------ dependency2.jar
| ------|subdir
| ------ file1
| ------ file2
这对我的应用程序不起作用,因为它明确要求一个\config
目录。
然而,这是我需要的目录结构:
| build
| --|install
| ----|bin
| ------ projectName
| ------ projectName.bat
| ----|lib
| ------ dependency1.jar
| ------ dependency2.jar
| ----|config
| ------|subdir
| ------ file1
| ------ file2
我该如何让Gradle将另一个目录添加到构建中,并将其指定为生成的启动脚本的类路径的一部分?
src/main/resources
中,我想应用程序插件也会将其打包。 - RaGesrc/main/resources
,但我的应用程序没有捕获它。我做错了什么? - Omar Darwish