Building and packaging projects

Building and packaging Maven projects needs execution of required phases, which we discussed in the preceding sections. Let's build and package hello-project from Chapter 3, Creating and Importing Projects, which we generated using archetypes. In the Default Lifecycle section, the phase package executes the following phases in order: compile, test, and package phases. Now, we will see how to invoke the package phase from m2eclipse. The following steps will ascertain this:

  1. Right-click on hello-project and select Run As. Click on Run Configurations and the Run Configurations window will appear.
  2. Right-click on Maven Build and choose New as shown in the following screenshot:
    Building and packaging projects
  3. Once the launch configurations window appears, fill in the details as shown in the following screenshot. For Base Directory, click on Browse Workspace... and choose hello-project from the pop-up list:
    Building and packaging projects
  4. Next, click on Apply and close it using the Close button.
  5. Again right-click on the project and select Run As, and click on Maven build as shown in the following screenshot:
    Building and packaging projects
  6. A window, as shown in the following screenshot, will appear with all the run configurations available:
    Building and packaging projects
  7. Choose the hello-package launch configuration and click on OK. It should compile, run tests, generate site documentation, and package in the target directory, as shown in following screenshot:
    Building and packaging projects
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.225.234.28