Problem with CommentedConfigurationNode and googles TypeToken

Hello there!

Here is a simplified code snippet of my problem:

HoconConfigurationLoader configLoader = HoconConfigurationLoader.builder().setFile(configFile).build();
CommentedConfigurationNode configNode = configLoader.load();
configNode.getNode("test").setValue("hi");

Eclipse keeps telling me, that I need to include com.google.common.reflect.TypeToken in my BuildPath, cause it is referenced in the last line…
I’ve seen this type of config handling in other plugins and now im quite confused where I messed up :frowning: If i add guava to my build path, everything is fine, but additional 2MB seems a bit… overkill?

Thanks in advance

The 2MB won’t end up in your plugin’s .jar as the guava library will already be provided by SpongeAPI.
So if you use a build tool like maven or gradle, just add the dependency in the “provided” scope.
If you’re not using any but instead run a plain eclipse project, just compile against guava but do not include it in your artifact.

If you’re using the right SpongeAPI file to compile against, it should be included there already, so it would be sufficient to only place that .jar in your classpath.

Right, when I dont include the guava jar in my artifact, everthings running fine on the server. But im quite confused, since the server uses the same SpongeForge jar that is included in eclipses buildpath. So why does this error occur in eclipse, but not on the server?
Surely a stupid question, sorry for that, but I’m relativ new to sponge :smiley:

The server manages third-party libraries automatically (take a look into the libraries folder in the server directory, there you will find them). In general, I’d recommend the use of a build system like gradle or maven, they can automatically find all dependencies of sponge. YOu can read more about that in this section of the docs: https://docs.spongepowered.org/en/plugin/workspace/index.html