diff --git a/org.jgrapes.util/bnd.bnd b/org.jgrapes.util/bnd.bnd index f65db6db332..aa0f6517482 100644 --- a/org.jgrapes.util/bnd.bnd +++ b/org.jgrapes.util/bnd.bnd @@ -9,12 +9,6 @@ Export-Package: \ org.jgrapes.util;version="${api_version}",\ org.jgrapes.util.events;version="${api_version}" -# Not directly referenced and not derived from gradle configuration -Import-Package: com.electronwill.nightconfig.json,\ - com.electronwill.nightconfig.toml,\ - com.electronwill.nightconfig.yaml,\ - * - -sources: true -dsannotations: diff --git a/org.jgrapes.util/build.gradle b/org.jgrapes.util/build.gradle index a750fa6a9bd..17535b4a81b 100644 --- a/org.jgrapes.util/build.gradle +++ b/org.jgrapes.util/build.gradle @@ -2,11 +2,11 @@ dependencies { api project(':org.jgrapes.core') implementation 'com.electronwill.night-config:core:[3.6.7,3.7]' - runtimeOnly 'com.electronwill.night-config:json:[3.6.7,3.7]' - runtimeOnly 'com.electronwill.night-config:toml:[3.6.7,3.7]' - runtimeOnly 'com.electronwill.night-config:yaml:[3.6.7,3.7]' + implementation 'com.electronwill.night-config:json:[3.6.7,3.7]' + implementation 'com.electronwill.night-config:toml:[3.6.7,3.7]' + implementation 'com.electronwill.night-config:yaml:[3.6.7,3.7]' // https://security.snyk.io/package/maven/org.yaml:snakeyaml - runtimeOnly 'org.yaml:snakeyaml:[1.33,2]' + implementation 'org.yaml:snakeyaml:[1.33,2]' testImplementation 'org.jdrupes.json:json:[2.0.0,2.1.0)' testRuntimeOnly project.files('test-resources') diff --git a/org.jgrapes.util/src/org/jgrapes/util/JsonConfigurationStore.java b/org.jgrapes.util/src/org/jgrapes/util/JsonConfigurationStore.java index 25024606e67..c788ea86115 100644 --- a/org.jgrapes.util/src/org/jgrapes/util/JsonConfigurationStore.java +++ b/org.jgrapes.util/src/org/jgrapes/util/JsonConfigurationStore.java @@ -118,6 +118,8 @@ public JsonConfigurationStore(Channel componentChannel, File file, public JsonConfigurationStore(Channel componentChannel, File file, boolean update, boolean watch) throws IOException { super(componentChannel, file, update, watch); + // Force load of JsonFormat and its registration. Required for OSGi. + com.electronwill.nightconfig.json.JsonFormat.minimalInstance(); config = FileConfig.builder(file.getAbsolutePath()).sync().concurrent() .build(); config.load(); diff --git a/org.jgrapes.util/src/org/jgrapes/util/TomlConfigurationStore.java b/org.jgrapes.util/src/org/jgrapes/util/TomlConfigurationStore.java index 3b0c0a581df..0776ae2e90f 100644 --- a/org.jgrapes.util/src/org/jgrapes/util/TomlConfigurationStore.java +++ b/org.jgrapes.util/src/org/jgrapes/util/TomlConfigurationStore.java @@ -114,6 +114,8 @@ public TomlConfigurationStore(Channel componentChannel, File file, public TomlConfigurationStore(Channel componentChannel, File file, boolean update, boolean watch) throws IOException { super(componentChannel, file, update, watch); + // Force load of TomlFormat and its registration. Required for OSGi. + com.electronwill.nightconfig.toml.TomlFormat.instance(); config = CommentedFileConfig.builder(file.getAbsolutePath()).sync() .concurrent().build(); config.load(); diff --git a/org.jgrapes.util/src/org/jgrapes/util/YamlConfigurationStore.java b/org.jgrapes.util/src/org/jgrapes/util/YamlConfigurationStore.java index 39840ad6b40..b19cbd7a271 100644 --- a/org.jgrapes.util/src/org/jgrapes/util/YamlConfigurationStore.java +++ b/org.jgrapes.util/src/org/jgrapes/util/YamlConfigurationStore.java @@ -118,6 +118,8 @@ public YamlConfigurationStore(Channel componentChannel, File file, public YamlConfigurationStore(Channel componentChannel, File file, boolean update, boolean watch) throws IOException { super(componentChannel, file, update, watch); + // Force load of YamlFormat and its registration. Required for OSGi. + com.electronwill.nightconfig.yaml.YamlFormat.defaultInstance(); config = FileConfig.builder(file.getAbsolutePath()).sync().concurrent() .build(); config.load();