1

mvn clean install builds successfully for file

package maven;

public class App {
    public static void main( String[] args ) {
        System.out.println( "Hello World!" );
    }
}

But if i change it to

package maveninvalid;

public class App {
    public static void main( String[] args ) {
        System.out.println( "Hello World!" );
    }
}

it still builds successfully. Build only fails when I enter an invalid variable or something else. I was expecting it would catch invalid package errors also, why doesn't it do that?

TastyCode
  • 5,679
  • 4
  • 37
  • 42
  • 2
    Same thing as there I guess: http://stackoverflow.com/questions/8395916/package-name-is-different-than-the-folder-structure-but-still-java-code-compiles. BTW, it's not Maven but the Java compiler that behaves like that. – Tome Oct 24 '13 at 16:25
  • Can you post your pom.xml? – Pablo Lascano Oct 24 '13 at 22:58
  • The package name must be the same where the java file is located which means the same folder on the file system. That's a basic java problem **not** a maven problem. – khmarbaise Oct 25 '13 at 09:29
  • [Answered here in another stackoverflow question](https://stackoverflow.com/questions/13414638/maven-java-package-declaration) – AmitM Jun 18 '19 at 08:28

0 Answers0