Question I can't use my library as dependency

tetratheta

New member
Oct 2, 2022
1
0
1
I'm trying to make a library that provides methods/classes that uses NMS, to plugin without making them implement NMS (by using paperweight-userdev).
And I made a library like this.

The problem is, I cant import it as library.

Code:
plugins {
  id 'java'
}

group = 'test'
version = '1.0-SNAPSHOT'

repositories {
  mavenLocal()
  mavenCentral()
  maven { url = "https://jitpack.io" }
  maven { url = 'https://repo.papermc.io/repository/maven-public/' }
  maven { url = 'https://oss.sonatype.org/content/groups/public/' }
}

configurations.implementation.canBeResolved = true
configurations.compileOnly.canBeResolved = true

dependencies {
  compileOnly 'io.papermc.paper:paper-api:1.19.2-R0.1-SNAPSHOT'
  implementation "com.gitlab.exmserver:mol:main-SNAPSHOT"
}
This is build.gradle code for test plugin. As you can see, I used JitPack for serving my library because Maven Central only accepts releases, not snapshots. I can't publish my library without testing.

If things work as intended, I should be able to use MPlayer class with importing com.gitlab.exmserver.mol package. But I can't.
I see error message like 'package com.gitlab.exmserver does not exist' and 'cannot find symbol' in Gradle's build error log, but no further information provided.

There must be problems with my library's build.gradle, but I can't find any.

Here are the build.gradle files of my library.

Code:
// build.gradle - root project
plugins {
  id("java")
  id("maven-publish")
  id("com.github.johnrengelman.shadow") version("7.1.2")
}
dependencies {
  implementation(project(":bukkit_1_19_R1")) {
    exclude module: ":core"
  }
  implementation(project(":core"))
}
publishing {
  publications {
    shadow(MavenPublication) { publications ->
      project.shadow.component(publications)
    }
  }
}
allprojects {
  apply plugin: "java"

  repositories {
    mavenCentral()
    maven{ url = "https://repo.papermc.io/repository/maven-public/" }
  }

  group = "com.gitlab.exmserver"
  version = "1.0.0-SNAPSHOT"
}
Code:
// bukkit_1_19_R1/build.gradle
plugins {
  id("io.papermc.paperweight.userdev") version("1.3.8")
}

dependencies {
  compileOnly(project(":core"))
  paperweightDevelopmentBundle("io.papermc.paper:dev-bundle:1.19.2-R0.1-SNAPSHOT")
}
Code:
// core/build.gradle
dependencies {
  compileOnly("io.papermc.paper:paper-api:1.19.2-R0.1-SNAPSHOT")
}

I've tried many things to solve this problem.
  • Invalidate Cache
  • Delete all repository/cache of Maven/Gradle
  • Force-kill all java.exe process
  • Restart IDEA or Reboot PC
  • Click 'Refresh' buton on IDEA Gradle panel
Now I don't have any idea what to do, and where to ask. This thing makes me really crazy.

What should I do?