Gradle only adds classes jar, not adding sources jar to dependencies

Gradle only adds classes jar, not adding sources jar to dependencies.

There is ServerCore-sources.jar in the maven local folder of ServerCore, that I’m gonna add to dependency.
And I used compileOnly(“kr.sul:ServerCore:1.0-SNAPSHOT”) for this work, in build.gradle.kts.

publishing {
    java {
    publications {
        create<MavenPublication>("maven") {
            groupId = as String
            version = rootProject.version as String

If your issue is that IntelliJ is not downloading the sources JAR, that is not something that Gradle does. You have to configure that in IntelliJ. You will not see a dependency for a sources JAR in the External Libraries for IntelliJ.

When I do the install task with maven(install JAR to local .m2), Intellij downloads the sources Jar automatically.
But when I do the same task with Gradle, Intellij doesn’t download the sources Jar.

Look at this Parachute.jar what is installed in .m2 with maven.

There is a setting in IntelliJ to tell maven to download sources. My guess is that you have this enabled.

Here is something that might help:

It looks like with the Idea Gradle plugin, you can configure IntelliJ to download sources via the Gradle build file.