Error occurred during initialization of boot layerjava.lang.module.ResolutionException:
So I tried to use one java project I have as a library for another project. I built the project into a .jar file and put it in as a library in the other project. In the module-info.java for the project I am trying to import as a library I have a dependency for fastjson. Here are the contents of module-info.java:
here is the module-info.java for the module I am trying to import in:
when I try to run it I get this:
Error occurred during initialization of boot layer
java.lang.module.ResolutionException: Module java.downloader contains package com.alibaba.fastjson.util, module fastjson exports package com.alibaba.fastjson.util to java.downloader
46 Replies
⌛
This post has been reserved for your question.
Hey @nikcho-kouhai! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
Hi, can you show us at least file structure of both modules?
this is what its actually called by the way
before it was java-youtube-downloader I renamed them in a bit of a desperate attempt
it did not work though. just keep in mind that's what they are called now and the problem ain't there
Well, from my experience of working with modules, I would recommend you to name modules same as your package. It will prevent a lot of unexpected issues.
I had to afk for a bit but now I'm back
I'll revert the name of the package to how it was before and rename the module to match the name of the package and see if that helps
same crap
Still same error?
okay so
I fixed it
by just importing the project as a module instead of using the .jar file
I still cannot understand what the problem was but now I have another issue
Ok, what is the problem now?
my other module which was called "attempt"
is ....is just
missing
bro what has java been smoking
weird shit has been hapenning the past 3 days
my source folder turned into a normal folder 2-3 times
and now one of my modules is just gone
the weirdest things is that I can still use the classes that were in that module
but I cannot see the module itself
And is is gone from the file system or only IntelliJ do not see it?
they aren't gone from the file system
I can run them just fine
I have them open as tabs on my IDE
the class "VideoPlayer" for example is from that other module
Have you tried to update Maven project in IntelliJ? In Maven tab, there is a refresh button
Sometimes it helps
I have 2 god damn pom files 💀
If not, Maven can not read the structure properly and that is causing issues
Now I understand
Show each of them
You messed it up
uh
the other one be tool ong
sec
Just the beginning
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.ikiulian</groupId>
<artifactId>java-youtube-downloader</artifactId>
<version>3.2.2</version>
<packaging>pom</packaging>
<name>Java youtube video downloader</name>
<description>Java parser for retrieving youtube video meta info</description>
<licenses>
<license>
<name>The Unlicense</name>
<url>http://unlicense.org/</url>
<distribution>repo</distribution>
</license>
</licenses>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
</plugin>
</plugins>
</build>
I like how one uses java 19 and the other one 17
It is so confusing. Please start from scratch. Create two new Maven projects and copy code into new ones. The current setup doesn't make sense.
okay I look into this folder and its completely unrelated, I have got no idea why its here its about as useful as me so I'm just gonna delete it
it also holds the other pom.xml file
yeah that's what I've been telling myself to do for a while
I'll try that now I suppose
Than do it
okay
I did it and now
I do have two modules which is nice
but uh
yeah I still have an issue
bro
how can u not find it
IF THERE'S LITERALLY 3 OF IT
Is it a Maven project? Have you added a dependency? Did IntelliJ recognized this dependency?
I don't think I can understate the low amounts of idea I have about what the hell is going on, its like atomic levels of "I have literally 0 idea"
its literally right there
Okay, than check which module does it exports
wait
I deleted the requires fastjson; line
re-wrote it
and now it works
See 😀
it WORKS
dude
I can't even
thank you
If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
just . thanks
I don't know how it got to this point in the first place but
hopefully nothing blows up in my face again
You are welcome 🤗
:thumbsupcat:
Post Closed
This post has been closed by <@359755548973072397>.