I have read a bunch of similar questions but I haven't been able to solve my issue so here I go:
I am trying to parse some objects to JSON files, and apparently I can import some phantom libraries (more on that later) but when I try to execute my code, it fails here:
String jsonStr = new ObjectMapper().writeValueAsString(adv);
With this exception:
Exception in thread "main" java.lang.NoClassDefFoundError:com/fasterxml/jackson/annotation/JsonView
My build.gradle:
plugins {
id 'java'
}
group 'com.myGroup.util'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
compileOnly 'org.projectlombok:lombok:1.18.4'
annotationProcessor 'org.projectlombok:lombok:1.18.4'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.0.1'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.0.1'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.0.1'
}
test {
useJUnitPlatform()
}
And in my Main.java class I can do this import:
import com.fasterxml.jackson.core.*;
with no problems, the only issue is that when I put the mouse on top it displays that no JavaDoc has been found, fishy... I even tried removing all the dependencies from my gradle.build file and it will still let me import the package but it seems like it is empty.
I'm very new to Gradle so If someone could point me in the direction of a solution would be extremely helpful, thank you!