Carleslc / Simple-YAML

This Java API provides an easy-to-use way to store data and provide configurations using the YAML format.
https://carleslc.me/Simple-YAML
GNU General Public License v3.0
130 stars 38 forks source link

'void org.yaml.snakeyaml.DumperOptions.setIndentWithIndicator(boolean)' #57

Closed Ciph3r-Zer0 closed 2 years ago

Ciph3r-Zer0 commented 2 years ago

I tried using Simple-Yaml library with a plugin for Velocity (https://velocitypowered.com) which is a minecraft proxy, but the issue is it gives out this error:

[22:47:11 ERROR]: Couldn't pass ProxyInitializeEvent to eris
java.lang.NoSuchMethodError: 'void org.yaml.snakeyaml.DumperOptions.setIndentWithIndicator(boolean)'
        at org.simpleyaml.configuration.implementation.snakeyaml.SnakeYamlImplementation.configure(SnakeYamlImplementation.java:182) ~[?:?]
        at org.simpleyaml.configuration.implementation.SimpleYamlImplementation.configure(SimpleYamlImplementation.java:149) ~[?:?]
        at org.simpleyaml.configuration.file.YamlConfiguration.setImplementation(YamlConfiguration.java:62) ~[?:?]
        at org.simpleyaml.configuration.file.YamlConfiguration.<init>(YamlConfiguration.java:52) ~[?:?]
        at org.simpleyaml.configuration.file.YamlConfiguration.<init>(YamlConfiguration.java:47) ~[?:?]
        at org.simpleyaml.configuration.file.YamlFile.<init>(YamlFile.java:49) ~[?:?]
        at org.simpleyaml.configuration.file.YamlFile.<init>(YamlFile.java:89) ~[?:?]
        at ir.ciph3r.eris.storage.yml.model.YMLModel.createFile(YMLModel.java:28) ~[?:?]
        at ir.ciph3r.eris.storage.yml.Config.<init>(Config.java:13) ~[?:?]
        at ir.ciph3r.eris.Eris.onProxyInitialization(Eris.java:40) ~[?:?]
        at ir.ciph3r.eris.Lmbda$1.execute(Unknown Source) ~[?:?]
        at com.velocitypowered.proxy.event.UntargetedEventHandler$VoidHandler.lambda$buildHandler$0(UntargetedEventHandler.java:47) ~[velocity-3.1.1-98.jar:3.1.1]
        at com.velocitypowered.proxy.event.VelocityEventManager.fire(VelocityEventManager.java:598) ~[velocity-3.1.1-98.jar:3.1.1]
        at com.velocitypowered.proxy.event.VelocityEventManager.lambda$fire$5(VelocityEventManager.java:479) ~[velocity-3.1.1-98.jar:3.1.1]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
        at java.lang.Thread.run(Thread.java:833) [?:?]

If you need any code from the project here is my YML model class: https://github.com/Ciph3r-Zer0/Eris/blob/master/src/main/java/ir/ciph3r/eris/storage/yml/model/YMLModel.java and here is the Config class: https://github.com/Ciph3r-Zer0/Eris/blob/master/src/main/java/ir/ciph3r/eris/storage/yml/Config.java

Carleslc commented 2 years ago

Seems like the snakeyaml version your plugin is using is not updated to the required version used by Simple-YAML, so the setIndentWithIndicator method is not found because is using an outdated version of snakeyaml. Maybe Velocity already includes an old version of snakeyaml and then Simple-Yaml tries to use that snakeyaml version? Assuming you're using maven, you can see if there is some maven dependency clash with: mvn dependency:tree -Dverbose

If there is a version clash, you can try including explicitly in your pom.xml the version specified by Simple-Yaml pom.xml, which in the v1.8 is snakeyaml latest version 1.30:

<dependency>
    <groupId>org.yaml</groupId>
    <artifactId>snakeyaml</artifactId>
    <version>1.30</version>
</dependency>

You could instead include it inside a dependencyManagement section:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.yaml</groupId>
            <artifactId>snakeyaml</artifactId>
            <version>1.30</version>
        </dependency>
    </dependencies>
</dependencyManagement>

Or use an exclusion to the Velocity dependency:

<exclusions>
    <exclusion>
        <groupId>org.yaml</groupId>
        <artifactId>snakeyaml</artifactId>
    </exclusion>
</exclusions>

Related info:

Related issues:

Ciph3r-Zer0 commented 2 years ago

It solved the issue, thanks