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

Depending on mountiplex module will cause build failed on first attempt #14

Open
LeeGodSRC opened this issue Sep 10, 2024 · 2 comments
Open

Comments

@LeeGodSRC
Copy link
Contributor

So I have a multi-module project structured like this:
plugin -> nms (mountiplex)

And on the first attempt of building, it always throw this exception

* What went wrong:
A problem was found with the configuration of task ':plugin:compileJava' (type 'JavaCompile').
  - Gradle detected a problem with the following location: '/home/leegod/Documents/ideaProjects/raytraced-antixray-bukkit-plugin/nms/modern/build/classes/java/main'.
    
    Reason: Task ':plugin:compileJava' uses this output of task ':nms:modern:remapAnnotations' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
    
    Possible solutions:
      1. Declare task ':nms:modern:remapAnnotations' as an input of ':plugin:compileJava'.
      2. Declare an explicit dependency on ':nms:modern:remapAnnotations' from ':plugin:compileJava' using Task#dependsOn.
      3. Declare an explicit dependency on ':nms:modern:remapAnnotations' from ':plugin:compileJava' using Task#mustRunAfter.
    
    For more information, please refer to https://docs.gradle.org/8.6/userguide/validation_problems.html#implicit_dependency in the Gradle documentation.
@bergerkiller
Copy link
Member

bergerkiller commented Sep 10, 2024

Strangely the solution for this was already applied here:

https://github.com/bergerhealer/Mountiplex/blob/master/mountiplex-gradle-plugin/src/main/java/com/bergerkiller/mountiplex/gradle/MountiplexPlugin.java#L29C28-L29C45

So it should just work. Is something special about your configuration that it might not match logic? Im not a big expert on gradle things

The way Ive used it is:
https://github.com/bergerhealer/BKCommonLib/blob/master/build.gradle.kts#L144

And this hasnt given me issues yet

mountiplex {
    remapAnnotationStrings()
}

If doing ^ doesnt fix it, maybe you can create a minimum reproducing example so I can test it myself?

@LeeGodSRC
Copy link
Contributor Author

I will try to recreate a reproducing example, but I figured a way to solve it.
You need to manually specify task dependency in the project for example:

:nms:modern is the project that contains mountiplex, and you will need to do

    named("compileJava") {
        mustRunAfter(":nms:modern:remapAnnotations")
    }

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

2 participants