#Issues with Maven Multi Modules
1 messages ยท Page 1 of 1 (latest)
hi
Hello
you have to include the dependencies you need in every sub-module too
Yea, that's what this one is. This is my sub-module 1_17_R1 and those are the dependencies.
idk if it helps, but here's my lib using modules: https://github.com/JEFF-Media-GbR/JeffLib
ah okay
one sec
does compiling fail, or just your IDE telling you that stuff can't be found?
Both.
okay since multi module stuff can get complicated - can you upload your FULL project to github?
then I can have a look
It would likely compile if I could resolve the dependency errors.
Sure, give me a sec to do so.
ping me when you sent the link pls
Hmm, running into some issues with uploading the files.
@livid anchor https://gitlab.com/Nothixal/hugs-multi-module
thanks will check out in some minutes
Hmmm, I reran BuildTools hoping it would just fix itself, but it didn't. I also put 1.16 in for fun and it works just fine. Is there something wrong with 1.17?
lets see
hm
what's this?
me.nothixal.hugs:core:pom:2.0.13-DEV
maven tells me that dependency is missing when running mvn package in your dist module
@livid anchor Wdym?
Like, I get that error too, but I'm not sure what's causing it.
I've been following Sateniel's tutorial and trying to work off of it, but it is a bit old.
oh sory
totally forgot about this
but again
you somewhere declared this to be used as dependency: me.nothixal.hugs:core:pom:2.0.13-DEV
what's that?
where does it come from?
@livid anchor I could only assume that it comes from the main pom.
uhm tbh
Well actually, the core module is used in almost every submodule.
you should know where you define your dependencies ๐
It's used in the 1_17, 1_18, and api submodules poms
normally your "main" / parent pom will only need your sub modules as dependency
and NOTHING else
Well, let me remove them and see what happens.
please have a look at the Lib I sent above again
I know maven module things are confusing
but
Well, thats the thing, it's even in yours.
to get them working you really have to be a bit patient and also check everything I sent
yes but
you have to check how your modules are called
the screenshot you sent, is it from my parent pom or from my dist pom?
It's from the 1_16 pom
yeah exactly
that's a SUB module
is the thing that's throwing errors for you also caused by some submodule?
Yes, I can't resolve the 1.17 spigot jar for some reason. I think that's causing most of the issues.
I've run BuildTools
I've actually ran it twice now.
okay pls show the part of your pom that says anything about 1.17
alright
you are NOT using the remapped 1.17 jar
but you should
add <classifier>remapped-mojang</classifier>
to your dependency
Which one?
oh sorry
I didn't see that
hmm
send your full maven log
it seems like you run BuildTools for 1.18.1
but not for 1.17
How do I retrieve that?
java -jar BuildTools.jar --rev 1.17 --remapped
I meant the maven log.
This is legit all I get atm
- click the red thing (the uppermost thing there)
- copy everything(!) from the yellow area
ok
this is your problem:
[ERROR] Failed to execute goal on project dist: Could not resolve dependencies for project me.nothixal.hugs:dist:jar:2.0.13-DEV: The following artifacts could not be resolved: me.nothixal.hugs:1_18_R1:jar:2.0.13-DEV, me.nothixal.hugs:1_17_R1:jar:2.0.13-DEV: Failure to find me.nothixal.hugs:1_18_R1:jar:2.0.13-DEV in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
You have something called "me.nothixal.hugs"
but you don't have that file in your local maven repository
is the thing that I mentioned something you made yourself?
Possibly, I wasn't even aware that it wasn't already made. I thought maven kinda just handled that.
The other thing is that the path me.nothixal.hugs actually has something in the local repository.
oh yeah i'm sorry
I just see that it's probably a submodule of your project
normally it should handle that fine
seems like you got your parent<>child pom relationship messed up
I'd love to help you debug further but I really gotta go to bed, it's 5am here
let me check a few things
oh wait
you are usig some 1.16 NMS
but you dont have any 1.16 module
I added it after I uploaded the files. I wanted to test if the 1.16 jar would resolve, which it did. The 1.17 one is giving me some trouble.
Oh
There are some files in the core module
Haven't moved them to their own sub-module yet.
Core ---> me.nothixal.hugs ---> managers ---> items
I know, I'm just trying to get one or two modules working in the first place.
then you must remove all 1.16 code for now
maven MUST be able to resolve ALL of your things
otherwise, obviously, it doesnt know where to get it from
I'm really sorry but it's 5am here now. I really must sleep soon. If you don't get it to work feel free to DM me in a few hours
but I gotta go to bed now
Alright, thanks for the help in the first place.
anyway, as said: ALL YOUR NMS must have their OWN module
I'll go ahead and separate it out.
np^^ okay, if you still have troubles DM me if you like. I'll answer ASAP
Hey, here's a better output. It's trying to grab from an actual maven repository, but I'm using a local repo. Is there a way I can set it to use the local one instead?
Nvm, I found that turning offline mode on fixes that issue.
Alright, I've gotten past the pom issues. Problem now is it's creating a 6MB jar file.
For the time being, I've removed 1.17 as it's still causing issues, but I'll work on this tomorrow night. I've got work in the morning.
Yo @livid anchor you around? I'm still having issues with my setup. I haven't been able to work on this issue since we left off. I have a week off for Christmas, so I can now attempt to fix these issues.
I have quite a few issues to resolve at the moment.
1. My final jar is 6MB. (It should be around 400KB)
--- Fixed by adding <scope>provided</scope> to all sub modules on the dependencies that are actually provided.
2. I'm getting warnings about cyclic dependencies.
3. Upon running the dist module, each sub module creates it's own target folder, which I would like to disable.
4. This isn't a big issue, but what I want is when I run the dist module, all changes that I've made to be included in the jar. As of right now, I have to run the install command before any changes will make it into the package stage. Is this something that can be achieved?
5. 1.17 is still bugged af. I'm not sure if it's due to my setup or some other factor.
6. The ${project.version} is not updating/replacing values in the files.
--- Fixed by adding ```xml
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
I've gone ahead and pushed my recent changes to the repo if you want to take a look.
oh sorry
I'm at my parents over christmas, will see if I have time to check it out
- I'm getting warnings about cyclic dependencies.
for what exactly?
- Upon running the dist module, each sub module creates it's own target folder, which I would like to disable.
That's normal and required
- This isn't a big issue, but what I want is when I run the dist module, all changes that I've made to be included in the jar. As of right now, I have to run the install command before any changes will make it into the package stage. Is this something that can be achieved?
You have to run clean on the root pom, and run package or install on the root pom to create your dist module with all changes from submodules
- 1.17 is still bugged af. I'm not sure if it's due to my setup or some other factor.
1.17 isn't bugged at all, must be something on your side ๐
- The ${project.version} is not updating/replacing values in the files.
Then you didn't have filtering resources enabled for those modules
Trying to import an ItemManager, ChatManager, and AdvancementManager in my core from the respective sub module for each version.
I have a VersionChecker class in the core under the utils package that sets the proper managers for the server version. Problem is that I have to depend on the modules in order to import, thus causing the warning.
your other modules should either depend on the core, or vice versa, but they cannot depend on each other
Well that makes sense. I guess my core is going to have to depend on all the modules.
Question is: do I have to change my dist Pom? Because right now, itโs the one that contains of all the sub module dependencies.
On the issue of cyclic dependencies. Right now, I have all of my modules relying on the core because of the utility classes that are utilized within.
I.E. PluginConstants & ChatUtils are being used in the modules, but ultimately come from the core module.
The problem arises when I want to register these sub module classes in the core module. I have a class that handles registration of the classes. However it needs the classes in the modules. This is clearly problematic, but I'm not sure how to resolve it.
Is there another way I should be doing this? A more proper solution?
hm you could of course just create another submodule that depends on nothing
you could add your ChatUtils thing there
that's probably the easiest solution
e.g. create another module, called "YourLibraryUtils" or something
which doesn't depend on anything besides spigot
then you are free to use that everywhere
Yea. but I still need the Interfaces from the core. Unless I can move those into the new module as well?
Ok, I went ahead with that idea, but I'm now wondering what the point of the dist module is. If my core is now depending on all of the modules, then the dist seems unnecessary.
Because when I run mvn clean install package on the parent module, everything seems to compile fine.
Well and now I have the same problem. My utils module needs to rely on the core because my utils classes rely on the main class because of all the dependency injection.
Either I have some serious spaghetti on my hands, or I have a fundamental misunderstanding of maven. They whole reason for me using it was so I could support versions back to 1.13.2. Which I know is possible, but either my project is literally incapable of being converted to maven, or everyone else's examples aren't applicable to my project.
@livid anchor Any idea how I should approach this moving forwards?