GeyserMC / MCAuthLib

A library for authentication with Minecraft accounts.
MIT License
51 stars 34 forks source link

[JAVA 9+] [Project Jigsaw] modules #30

Open freedom1b2830 opened 10 months ago

freedom1b2830 commented 10 months ago

I'm facing a multi-version problem for my project.

I wanted to implement this as separate services via ServiceLoader. But when I included dependencies of your MCProtocolLib in my project module.

I found that my IDE showed that the module name was guessed based on the name of the jar file.

And one of your projects (this one) does not allow you to use the chosen name at all due to the presence of a number at the beginning, which breaks the basic requirements of the jigsaw project.

module project.mymodule {
        requires mcprotocollib; (<- name from name.jar)
        (If the name of the jar file changes, the project builder will not be able to find the jar of the module and this will cause an error.)

        requires mcauthlib.6621fd081c; CRIT ERROR (<- name from name-version.jar)
        (If there is a number at the beginning of a part of the module name, then this module cannot be used in your project)
}

The steps I suggest: 1.Please use java version 9 or higher. 2.Implement a modular structure in your projects 3.Don't use git commit as a version for projects(This violates the core rules of the jigsaw project)

To implement this Create a new project that will contain the example code: https://github.com/GeyserMC/MCAuthLib/blob/master/example/com/github/steveice10/mc/auth/test/MinecraftAuthTest.java https://github.com/GeyserMC/MCProtocolLib/blob/master/example/src/main/java/com/github/steveice10/mc/protocol/test/MinecraftProtocolTest.java

This can prompt you to solve this problem: https://github.com/GeyserMC/MCProtocolLib/issues/686

see https://www.infoq.com/articles/Latest-Project-Jigsaw-Usage-Tutorial/ https://dzone.com/articles/java-9-modularity-jigsaw

Konicai commented 10 months ago

this will probably be resolved with the 1.21 release of MCPL