Search code examples
javamavenintellij-ideadependenciesmvn-repo

My java project can't recognize a class from my other custom maven dependency from local repository


I have issues with Maven 3 / Intellij .

As you see in this picture , I can't use my custom dependency classes in a new different project. it seems that intellij (same issue with eclipse) does not recognize the class IRunnableTask.java from the dependency scheduler (package : com.sifoklus.scheduler.task) although it's installed in my local maven repository and I can see it in External Libraries view in IntelliJ Screenshot of IntelliJ

Here is my local repository path from setting.xml Screenshot with XML

and the dependency is well installed in the same path : Screenshot of Windows Explorer

and I added this dependency to my new project using : Screenshot of Maven dependencies XML in IntelliJ

Intellij is using the right settings file and the right local repo Screenshot of Maven settings in IntelliJ

I 've already tried to delete cache and restart . the problem is not fixed.

Do you know what is the problem and how it can be resolved ? Thank you

I tried to delete cache and restart . nothing changed

[[EDIT]]

Hello @romanv-jb

the error in 'problem' view says : cannot resolve symbol sifoklus (name of one folder in the package) . If I click more actions : one of the options is Add maven Dependency ,

enter image description here

when I click on this option , the intellij pop up finds the dependency but when I choose it , nothing changes. enter image description here

The code of Interface IRunnableTask is : enter image description here


Solution

  • Judging from the directory structure inside the com.sifoklus:scheduler jar file, it appears the repackage goal of the spring-boot-maven-plugin was run during its build. All the com.sifoklus.* classes should appear at the root rather than under BOOT-INF/classes.

    If indeed scheduler has the plugin spring-boot-maven-plugin defined in its POM file, with an execution goal of repackage, try removing this plugin, and rebuild scheduler using mvn clean install.