Closed thelipe7 closed 2 years ago
This is not a Simple-YAML bug; it is a known issue related to a dependency clash between Velocity and Simple-YAML.
Velocity uses an older version of snakeyaml (1.26) than this library requires (1.30 or above, latest version uses 1.32). Because of this, there is a dependency clash, so even if the correct version is built with maven into your plugin through Simple-Yaml, in runtime at the moment of loading your plugin the first loaded version prevails, which sadly happens to be the older one loaded by the Velocity server.
See this comment to read a more detailed explanation for the error and the solution, which is relocation to differentiate both versions in runtime using different classpaths.
Example of maven-shade-plugin
using relocation to solve the error:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.4.1</version>
<executions>
<execution>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<relocations>
<relocation>
<pattern>org.yaml.snakeyaml</pattern>
<shadedPattern>net.servidor.commons.libs.snakeyaml</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
Since 1.8.3 the manual relocation is not needed as it is already included. Add the relocation in 1.8.2 or update to 1.8.3. I'm closing the issue. Comment if you have any doubts.
Thanks :)
I am getting the following error when creating a config:
My code: