As we have already mentioned, Maven helps to compose the javac and java commands when you compile and run your application. It sets the value of the -classpath option. To accomplish it, Maven reads the list of libraries your project needs from pom.xml. It is your responsibility to correctly specify these libraries. Otherwise, Maven will not be able to find them.
By default, the pom.xml file is located in the project root directory. That is also the directory where IDE runs the javac command and sets the src/main/java directory on the classpath so that javac can find the source files of your project. It puts the compiled .class files in the target/classes directory into the root directory too, and sets this directory ...