-
Before re-compiling the project, it's a good practice to clean it (
mvn clean
). This removes thetarget
directory, which contains all the output from previous compilations. -
To compile the project and also package it (into a .jar file), you can use the package goal (
mvn package
) instead of just compiling (mvn compile
). This command will compile the code and also package it according to the specifications in thepom.xml
file.