Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

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

Open
freedom1b2830 opened this issue Jan 20, 2024 · 1 comment
Open

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

freedom1b2830 opened this issue Jan 20, 2024 · 1 comment

Comments

@freedom1b2830
Copy link

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:
GeyserMC/MCProtocolLib#686

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

@Konicai
Copy link
Member

Konicai commented Jan 20, 2024

this will probably be resolved with the 1.21 release of MCPL

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants