user2018675 user2018675 - 10 months ago 27
Java Question

Classes packages don't include src.main.java, however it is there and eclipse complains about it

I've downloaded an open source library which has the source laid out like this:

src.main.java.company.name


However the source files always have their package name omitting the
src.main.java
part, for example:

package company.name.DataAccessControler


and eclipse complains about it. Of course I could rename each file, but there are dozens of files and I'm pretty sure I'm missing something.

The
pom.xml
doesn't have any references to
src.main.java
.

What could be the cause of it, and how to fix it? I believe it might related to eclipse.

Answer

There is nothing wrong with your library... Since this is a Maven project, /src/main/java is the default directory layout :

https://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html

You shouldn't touch the build path since this is managed by the Maven Plugin in Eclipse.

Try a right-click - Maven - Update.