Home > Articles > Programming > Java

  • Print
  • + Share This
Like this article? We recommend

Building the Project

The final step is to build the example project. Notice that the project.xml file does not have any targets nor any instructions whatsoever with regard to building the project. This is the true strength of Maven. Maven derives all of its targets (called goals) from plug-ins. The base install of Maven comes with a large listing of these goals—most of the common development tasks are included. To build the project, all we have to do is tell Maven to execute one of these goals:

maven java:compile

This command tells Maven to execute the compile goal in the Java section. With this simple command, Maven will read in the project.xml file, verify all the dependencies, download the required jar files, construct the target (build) directories, and compile all the Java code. If we had any JUnit tests in our test section, it would have automatically executed the unit tests as well.

  • + Share This
  • 🔖 Save To Your Account