Nemo
Nemo

Reputation: 157

Java class doesn't have to match package written in source file

in my project I wrote java class but by mistake put it into subfolder which is not same as mentioned package in source file. By chance I wrote this code not in some IDE therefore didn't noticed the mistake. My build system is maven and surprisingly the class was compiled and put into correct subdirectory of generated class files without any error. How can I configure maven compiler plugin or other maven plugin to recognize such mismatch when compile ?

Upvotes: 1

Views: 207

Answers (1)

Nemo
Nemo

Reputation: 157

I found how I can prevent such mismatch - it can be done by using CheckStyle PackageDeclaration module(javadoc)

Upvotes: 1

Related Questions