Building a multimodule project

Now that we are done with writing the code for modules, let's build the project. Right-click on the parent project—in this case, Distance-main—select Run As, and click on Maven test. This should compile and run the unit tests. An excerpt of the output in the console is as follows:

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] Distance-main
[INFO] distance-core
[INFO] distance-webapp Maven Webapp
[INFO] 
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]                                                              
[INFO] ------------------------------------------------------------------------
[INFO] Building Distance-main 0.0.1-SNAPSHOT
[INFO] ---------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Building distance-core 0.0.1-SNAPSHOT
[INFO] ----------------------------------------------------------
------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.packt.chpt6.mydistance.util.ConversionUtilTest
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.009 sec

Results :

Tests run: 4, Failures: 0, Errors: 0, Skipped: 0

[INFO]                                                          
[INFO] ------------------------------------------------------------------------
[INFO] Building distance-webapp Maven Webapp 0.0.1-SNAPSHOT
[INFO] ---------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] Distance-main ..................................... SUCCESS [  0.002 s]
[INFO] distance-core ..................................... SUCCESS [  2.250 s]
[INFO] distance-webapp Maven Webapp ...................... SUCCESS [  0.161 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

The mechanism referred to as a reactor knows the order of building a project. Now again, right-click on Distance-main, select Run As, and click on Maven install to install the modules in a local repository.

Note

Always make sure to clean the project by running Maven clean via the Run As option if any changes occur; alternatively, you can reinstall the project using Maven install.

..................Content has been hidden....................

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