如何在gradle的类路径之外指定石英属性文件?

问题描述 投票:3回答:1

我正在尝试在gradle中指定我的石英属性文件。从'config'目录而不是从资源。

String quartzProperties = System.properties['org.quartz.properties'] ?: "file:config/local/quartz.properties"
System.setProperty("org.quartz.properties", quartzProperties)

]的输出>

(System.properties).each {
    println "Prop ${it}"
}

或属性任务,是

Prop quartz.properties=file:config/local/quartz.properties

石英的输出是

PropertiesFactoryBean      --- Loading properties file from class path resource [quartz.properties]
SchedulerConfig$$EnhancerB --- Cannot load quartz.properties.

未设置的症状是我得到了错误的sql方言,因此应用程序在加载时给出了数据库错误。

我正在尝试在gradle中指定我的石英属性文件。从“ config”目录而不是从资源。字符串quartzProperties = System.properties ['org.quartz.properties']?:“ file:...

java gradle quartz
1个回答
0
投票

我有相同的问题,看着您的代码,使用file:config/local/quartz.properties很可能是错误的。官方文档实际上只在该属性中添加了一条路径,没有任何URI前缀或任何前缀。该前缀很可能使路径无效,并且Quartz无法找到它。以下是example from GitHub

© www.soinside.com 2019 - 2024. All rights reserved.