#Grade java compiler fails to compile because of dependency

43 messages · Page 1 of 1 (latest)

hidden relic
#

I am building the java-jwt 4.5.0 from sources using gradle 9.3.1. The code is not compiling and the dependencies are declared.
What is giving errors are undefined symbols of the fasterxml.jackson.core and fasterxml.jackson.databind dependencies.
These dependencies are declared like below :
dependencies {
implementation 'com.fasterxml.jackson.core:jackson-core:2.15.4'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.15.4'
...
I haven't changed the gradle scripts. How can I debug this further ?
Thanks,
Regards

blazing pivotBOT
#

This post has been reserved for your question.

Hey @hidden relic! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

misty goblet
#

have you tried gradle clean build
or ./gradlew clean compile

can you please provide the error log?

blazing pivotBOT
#

💤 Post marked as dormant

This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping.
Warning: abusing this will result in moderative actions taken against you.

karmic pasture
karmic pasture
#

for version 2.15.0 at least

hidden relic
hidden relic
#

what I am doing now is from the project's root directory './gradlew :java-jwt:compileJava'

#

but I am still getting the compilation errors related to the fact that the jackson core and databind dependencies seem to not be visible to the compilation step

#

I did the following :

#
dlsa@besta java-jwt-4.5.0 % ./gradlew :java-jwt:dependencies --configuration compileClasspath

> Configure project :java-jwt
Using version 4.5.0 for java-jwt group com.auth0

> Task :java-jwt:dependencies

------------------------------------------------------------
Project ':java-jwt'
------------------------------------------------------------

compileClasspath - Compile classpath for source set 'main'.
+--- com.fasterxml.jackson.core:jackson-core:2.15.4
|    \--- com.fasterxml.jackson:jackson-bom:2.15.4
|         +--- com.fasterxml.jackson.core:jackson-annotations:2.15.4 (c)
|         +--- com.fasterxml.jackson.core:jackson-core:2.15.4 (c)
|         \--- com.fasterxml.jackson.core:jackson-databind:2.15.4 (c)
\--- com.fasterxml.jackson.core:jackson-databind:2.15.4
     +--- com.fasterxml.jackson.core:jackson-annotations:2.15.4
     |    \--- com.fasterxml.jackson:jackson-bom:2.15.4 (*)
     +--- com.fasterxml.jackson.core:jackson-core:2.15.4 (*)
     \--- com.fasterxml.jackson:jackson-bom:2.15.4 (*)

(c) - A dependency constraint, not a dependency. The dependency affected by the constraint occurs elsewhere in the tree.
(*) - Indicates repeated occurrences of a transitive dependency subtree. Gradle expands transitive dependency subtrees only once per project; repeat occurrences only display the root of the subtree, followed by this annotation.
karmic pasture
hidden relic
#

ok, I didn't know that. I just looked at it and jackson core is not on it

karmic pasture
#

Can you show the exact output when compiling it with Gradle?

#

Where exactly are you trying to use jackson?

#

Which build.gradle file contains the jackson dependency?

#

It's possible you declared the dependency in the wrong module - you need the dependency where you are using it

hidden relic
#

jackson is a dependency of the java-jwt project

#

which I am trying to build

#

the dependency is stated in the build.gradle file under the lib subdir

#

I added the jackson core package to the module-info.java and ran the compile step but am getting the same errors

karmic pasture
#

Where exactly is the dependency declared?

#

Is it declared in libs/build.gradle?

hidden relic
#

yes

#
dependencies {
    implementation 'com.fasterxml.jackson.core:jackson-core:2.15.4'
    implementation 'com.fasterxml.jackson.core:jackson-databind:2.15.4'

    testImplementation 'org.bouncycastle:bcprov-jdk15on:1.70'
    testImplementation 'junit:junit:4.13.2'
    testImplementation 'net.jodah:concurrentunit:0.4.6'
    testImplementation 'org.hamcrest:hamcrest:2.2'
    testImplementation 'org.mockito:mockito-core:4.4.0'

    jmhImplementation sourceSets.main.output
    jmhImplementation 'org.openjdk.jmh:jmh-core:1.35'
    jmhAnnotationProcessor 'org.openjdk.jmh:jmh-generator-annprocess:1.35'
}
karmic pasture
#

What happens when trying to add it as a requires declaration in the module-info.java?

hidden relic
#
module com.auth0.jwt {
    requires com.fasterxml.jackson.core;
    requires com.fasterxml.jackson.databind;

    exports com.auth0.jwt;
    exports com.auth0.jwt.algorithms;
    exports com.auth0.jwt.exceptions;
    exports com.auth0.jwt.interfaces;
}
#

same compile errors

#

the first requires was missing, I added it

#

before the classes in that package were the ones causing unknown symbol in the compilation

#

but after adding the requires, the result is the same

misty goblet
#

I see a problem
Going through jakson.databind pom.xml and module-info.

com.fasterxml.jackson.databind already has a dependency of com.fasterxml.jackson.core in it.

so you need to **remove **implementation 'com.fasterxml.jackson.core:jackson-core:2.15.4' from your dependencies list.

And since jakson.databind's module-info transitively exports core and annotation you** dont need to include** requires com.fasterxml.jackson.core; in your module com.auth0.jwt

Try to compile it after that

blazing pivotBOT
#

💤 Post marked as dormant

This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping.
Warning: abusing this will result in moderative actions taken against you.

hidden relic
#

then I am back to the previous scenario, which causes the same compilation errors

karmic pasture
#

Do you share the full lib/build.gradle?

hidden relic
#

I just quit trying to compile java-jwt. The build system from the distribution seems to be broken. I found the jjwt library and am going with that. It builds with maven and with success

#

I am going to close this thread. What I also need to do is get to know gradle better. I am a noob at it

blazing pivotBOT