New to java development here. I'm using gradle in eclipse.
I want to import the JSONParser. In my code I have:
import org.json.simple.parser.JSONParser;
and in build.gradle I have:
repositories {
mavenCentral()
}
dependencies {
compile 'com.googlecode.json-simple:json-simple:1.1.1'
}
However, when I try to build I get:
int/MainApp.java:7: error: cannot find symbol
import org.json.simple.parser;
^
symbol: class parser
location: package org.json.simple
1 error
What's going on here? I think I don't understand exactly how gradle works.
please clean and rebuild again might be work otherwise please read the library instruction carefully or just try to put
repositories {
maven {
url "https://jitpack.io"
}
}
Try it, it may helpful for you:
buildscript {
ext {
springBootVersion = '2.1.0.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-
plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
group = 'com.xyz'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile 'com.googlecode.json-simple:json-simple:1.1.1'
}
If you have the jar files in a folder, for example in the lib folder in root directory, add the following to your gradle build
dependencies
{
compile files('libs/something_local.jar')
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.