0

I get this error when I try run my project. After many hours of search I found out why this happens, but I have no idea how to exclude one from exporting the package.

java.lang.module.ResolutionException: Modules spring.aop and aopalliance export package org.aopalliance.intercept to module spring.beans

It is my first time with Spring in general (I need JPA for CRUD I'm working now with Hibernate). I used Intellij IDEA's "Add Framework..." function in order to add Spring Data JPA. My Maven pom doesn't include any spring related things, I'm using module-info.java to load required things related to the Spring framework.

    requires spring.beans;
    requires spring.context;
    requires spring.tx;
  • Read https://spring.io/guides/gs/intellij-idea/ – Sully May 01 '20 at 18:13
  • @HithamS.AlQadheeb How creating new project will help me? I'm trying to figure out how to prevent module from exporting a package so I won't have this situation. Also I'm not working on REST. This is related to the Spring Data JPA only. – Maki Nishikino May 01 '20 at 18:44
  • Why don't you do your dependency management with Maven and just let IDEA import that Maven project? That way you have a build configuration which works on the command line via `mvn verify`, `mvn install` etc. and works in all major IDEs like IDEA and Eclipse too if you just let them use the POM as its source for the build configuration. – kriegaex May 04 '20 at 05:11
  • @kriegaex this is why `Error:(6, 11) java: package org.hibernate is not visible (package org.hibernate is declared in the unnamed module, but module org.example does not read it)` I'm not using class-path, from my understanding of Java 9+, you have to declare them in `module-info.java`. – Maki Nishikino May 04 '20 at 15:48
  • I am not much acquainted with the Java module system. But I do know that it cannot replace proper build dependency management. You can for instance not manage versions. So using Java modules in oder to declare runtime dependencies does not make proper build dependency management obsolete. You better learn about it. – kriegaex May 06 '20 at 01:53
  • As for your problem, there is not enough information in order to answer your question. Please be advised to learn what an [MCVE](https://stackoverflow.com/help/mcve) is and then produce one in order to improve both your question and with it the chance to get a good answer here. Thank you. :-) – kriegaex May 06 '20 at 01:54

0 Answers0