Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in multi gradle module #161

Closed
cosmohdx opened this issue Aug 29, 2022 · 3 comments
Closed

Error in multi gradle module #161

cosmohdx opened this issue Aug 29, 2022 · 3 comments

Comments

@cosmohdx
Copy link

If you use paperweight in mutli module project its working until paperweight is implemented in a second module in the same project.

settings.gradle.kts

include("shared")
include("bukkit")
include("bukkit-mixin")
include("service")

pluginManagement {
    repositories {
        gradlePluginPortal()
        maven("https://repo.papermc.io/repository/maven-public/")
    }
}

the projects bukkit and bukkit-mixin have implemented paperweight.

plugins {
  id("com.github.johnrengelman.shadow") version "7.1.2"
  id("io.papermc.paperweight.userdev") version "1.3.8"
}

dependencies {
  paperDevBundle("1.19.2-R0.1-SNAPSHOT")
}

When adding paperweight to the first module, all is working well.
When adding to the second module, this error occures:

class io.papermc.paperweight.userdev.internal.setup.UserdevSetup$Inject cannot be cast to class io.papermc.paperweight.userdev.internal.setup.UserdevSetup (io.papermc.paperweight.userdev.internal.setup.UserdevSetup$Inject is in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader @534a0a01; io.papermc.paperweight.userdev.internal.setup.UserdevSetup is in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader @660d1a82)
class io.papermc.paperweight.userdev.internal.setup.UserdevSetup$Inject cannot be cast to class io.papermc.paperweight.userdev.internal.setup.UserdevSetup (io.papermc.paperweight.userdev.internal.setup.UserdevSetup$Inject is in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader @534a0a01; io.papermc.paperweight.userdev.internal.setup.UserdevSetup is in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader @660d1a82)
@lynxplay
Copy link
Contributor

You will need to configure the paperweight plugin in your root module with apply false. E.g:

plugins {
  id("io.papermc.paperweight.userdev") version "1.3.8" apply false
}

in your root build.gradle.kts

and then

plugins {
  id("io.papermc.paperweight.userdev")
}

in your modules build.gradle.kts

I'll close this as I believe we have been telling developers to set it up this way for a while. If someone is willing to try to fix this, I can reopen this issue as a tracking issue for progress made.

@lynxplay lynxplay closed this as not planned Won't fix, can't repro, duplicate, stale Aug 29, 2022
@jpenilla
Copy link
Member

If someone is willing to try to fix this, I can reopen this issue as a tracking issue for progress made.

This is a gradle issue, there is nothing we can do from our side

@lynxplay
Copy link
Contributor

Ah sweet, TIL 👍

TylerS1066 added a commit to APDevTeam/Movecraft that referenced this issue Jun 18, 2024
TylerS1066 added a commit to APDevTeam/Movecraft that referenced this issue Jun 20, 2024
… libraries (#652)

* Update gitignore

* Initial conversion

* Fix API compile

* Move NMS from libs to individual files

* Remove 1.19.4

* Remove maven

* Remove devcontainer

* Now we're cooking with mojang mappings

1.18 worldhandler compiles

* Build completed?

* Update CI

* Update gradle permissions

* Add datapack build

* Start working on Movecraft build

* Almost there with shadowJar

* WIP

* Clean up

* Working datapack and license to jar

* Add roaringbitmap as library

* Fix version embed

* WIP

* Reorganize modules

* Try fix for PaperMC/paperweight#161

* Build a (hopefully) working jar

* Fix 1.18 being mojang mapped

* Refactor audiences
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants