【发布时间】:2018-05-30 17:26:09
【问题描述】:
我正在尝试使用 Hocon 格式在 Vertx 中进行配置。我还为它添加了 maven 依赖项。
<dependency>
<groupId>com.typesafe</groupId>
<artifactId>config</artifactId>
<version>1.3.3</version>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-config-hocon</artifactId>
<version>3.5.1</version>
</dependency>
代码在eclipse中编译得很好。
Vertx vertx = Vertx.vertx();
DeploymentOptions options = new DeploymentOptions();
ConfigStoreOptions store = new ConfigStoreOptions().setType("file").setFormat("hocon").setConfig(new JsonObject().put("path", System.getProperty("configPath")));
ConfigRetriever retriever = ConfigRetriever.create(vertx, new ConfigRetrieverOptions().addStore(store));
但是,当我运行二进制文件并将 hocon 配置文件作为命令行参数传递时,我收到以下未知配置异常:
java.lang.IllegalArgumentException: unknown configuration format: hocon (supported formats are: [json, raw, properties]
我还检查了 jar 文件中的io.vertx.config.spi.ConfigProcessor。而且我没有找到预期的io.vertx.config.hocon.HoconProcessor。
我是否缺少 POM 文件中的一些构建配置? POM 文件中是否包含任何重要内容来解决此问题。
【问题讨论】:
标签: java vert.x typesafe-config