Maven + Java package declaration

Posted by Vasan on Stack Overflow See other posts from Stack Overflow or by Vasan
Published on 2012-11-16T10:22:59Z Indexed on 2012/11/16 11:01 UTC
Read the original article Hit count: 157

Filed under:
|
|

We have a Maven project (packaged as JAR) with Java files. A new Java source file was recently added to this project. The path in which the Java file was added, does not match its package declaration. As expected, Eclipse shows an error in the class for the mismatch. However, Maven builds the project just fine. In the generated JAR file, the .class file is present in the path indicated by the package declaration. We tried moving the Java source file to other incorrect folders (i.e. different from the package declaration), but every time Maven builds the project fine.

So, does Maven ignore the actual directory in which the .java file is present? Does it only consider package declaration?

© Stack Overflow or respective owner

Related posts about java

Related posts about maven