Gradle Dependencies

663 views Asked by At

I'm trying to use JSON Simple to parse a JSON file into Java in a Gradle JavaFX project.

I've tried a few things:

  1. Adding implementation group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1' to the build.gradle file. ... Won't let me do import org.json.simple.JSONParser;

Error: error: package org.json.simple does not exist

  1. Adding implementation 'com.googlecode.json-simple:json-simple:1.1.1' to the build.gradle file. ... gives same error as above.

  2. In IntelliJ, I've tried manually downloading and adding the jar file:

First I added a new directory to the root called 'libs' and added the jar file there. Went to File > Project Structure > Libraries > '+' > Java, selected the file and pressed the module I wanted to add it to. Then I added requires json.simple; into the module-info.java file.

IntelliJ does not come up with any errors, but when I do gradle run, it comes up with an error in the modules-info.java file that says error: module not found: json.simple

I have no idea why that last error is happening, I made sure the module was applied to the root as well (Where the modules-info.java file is.

I've tried gradle clean, invalidating caches and removing caches altogether.

If anyone knows why this issue is occuring (or can suggest another way I can parse a JSON file), that would be great!

Thanks in advance.

0

There are 0 answers