Maven dependencies not accessible in Java

mius :

I have a project managed by Maven which I am trying to get to work in Eclipse. The problem is that all the dependencies which are being managed by Maven are not accessible inside the Java code.

In Eclipse I get an error on the imports for the respective classes:

The type org.apache.commons.math3.util.Pair is not accessible

while when I try to build the project with Maven I get the error:

package org.apache.commons.math3.util is not visible (package org.apache.commons.math3.util is declared in the unnamed module, but module org.apache.commons.math3.util does not read it)

The dependencies have been downloaded by Maven and I can find them in the .m2 folder. I can even see the jar files when looking at the Java build path in Eclipse.

I also get the same error when I try to use Maven through the command line.

Does anyone know why this could be happening?

mius :

I managed to fix it. I don't know why but by not creating the module-info.java file when eclipse asked me, everything worked just fine.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=96534&siteId=1