#Issues with Maven Multi Modules

1 messages ยท Page 1 of 1 (latest)

shrewd sage
livid anchor
#

hi

shrewd sage
#

Hello

livid anchor
#

you have to include the dependencies you need in every sub-module too

shrewd sage
#

Yea, that's what this one is. This is my sub-module 1_17_R1 and those are the dependencies.

livid anchor
livid anchor
#

one sec

#

does compiling fail, or just your IDE telling you that stuff can't be found?

shrewd sage
#

Both.

livid anchor
#

okay since multi module stuff can get complicated - can you upload your FULL project to github?

#

then I can have a look

shrewd sage
#

It would likely compile if I could resolve the dependency errors.

#

Sure, give me a sec to do so.

livid anchor
#

ping me when you sent the link pls

shrewd sage
#

Hmm, running into some issues with uploading the files.

shrewd sage
livid anchor
#

thanks will check out in some minutes

shrewd sage
#

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?

livid anchor
#

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

shrewd sage
#

@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.

livid anchor
#

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?

shrewd sage
#

@livid anchor I could only assume that it comes from the main pom.

livid anchor
#

uhm tbh

shrewd sage
#

Well actually, the core module is used in almost every submodule.

livid anchor
#

you should know where you define your dependencies ๐Ÿ˜›

shrewd sage
#

It's used in the 1_17, 1_18, and api submodules poms

livid anchor
#

normally your "main" / parent pom will only need your sub modules as dependency

#

and NOTHING else

shrewd sage
#

Well, let me remove them and see what happens.

livid anchor
#

please have a look at the Lib I sent above again

#

I know maven module things are confusing

#

but

shrewd sage
#

Well, thats the thing, it's even in yours.

livid anchor
#

to get them working you really have to be a bit patient and also check everything I sent

livid anchor
#

you have to check how your modules are called

#

the screenshot you sent, is it from my parent pom or from my dist pom?

shrewd sage
#

It's from the 1_16 pom

livid anchor
#

yeah exactly

#

that's a SUB module

#

is the thing that's throwing errors for you also caused by some submodule?

shrewd sage
#

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.

livid anchor
#

okay pls show the part of your pom that says anything about 1.17

shrewd sage
livid anchor
#

alright

shrewd sage
livid anchor
#

you are NOT using the remapped 1.17 jar

#

but you should

#

add <classifier>remapped-mojang</classifier>

#

to your dependency

shrewd sage
#

Which one?

livid anchor
#

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

shrewd sage
#

How do I retrieve that?

livid anchor
#

java -jar BuildTools.jar --rev 1.17 --remapped

shrewd sage
#

I meant the maven log.

livid anchor
#

it's at the bottom of your IDE

#

one sec

shrewd sage
#

This is legit all I get atm

livid anchor
#
  1. click the red thing (the uppermost thing there)
#
  1. copy everything(!) from the yellow area
shrewd sage
livid anchor
#

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?

shrewd sage
#

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.

livid anchor
#

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

shrewd sage
#

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

livid anchor
#

yeah okay but

#

your 1.16 NMS must have its own module too

shrewd sage
#

I know, I'm just trying to get one or two modules working in the first place.

livid anchor
#

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

shrewd sage
#

Alright, thanks for the help in the first place.

livid anchor
#

anyway, as said: ALL YOUR NMS must have their OWN module

shrewd sage
#

I'll go ahead and separate it out.

livid anchor
#

np^^ okay, if you still have troubles DM me if you like. I'll answer ASAP

shrewd sage
#

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?

shrewd sage
#

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.

shrewd sage
#

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.

livid anchor
#

I'm at my parents over christmas, will see if I have time to check it out

#
  1. I'm getting warnings about cyclic dependencies.
    for what exactly?
#
  1. 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
#
  1. 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. 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 ๐Ÿ˜›
#
  1. The ${project.version} is not updating/replacing values in the files.
    Then you didn't have filtering resources enabled for those modules
shrewd sage
#

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.

livid anchor
#

your other modules should either depend on the core, or vice versa, but they cannot depend on each other

shrewd sage
#

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.

shrewd sage
#

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?

livid anchor
#

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

shrewd sage
#

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.

shrewd sage
#

@livid anchor Any idea how I should approach this moving forwards?