- Hands-On Microservices with Kotlin
- Juan Antonio Medina Iglesias
- 341字
- 2021-06-30 19:10:52
Life cycle phases
If we've followed the previous section, we have a Maven project already, so we can go to our terminal and from the project folder. Just execute the following command:
mvn compile
Alternatively, if we use the wrapper, most likely we should use the following:
mvnw compile
The first time that we run this command, if the application dependencies are not in our system, they will be downloaded and then the application will compile. The next time we launch the same command, if the software has changed it will compile, if not it will inform us that nothing has changed.
What we have set as a parameter when we were invoking Maven, compile, is a Maven life cycle phase. There are many standard phases, let's look at the one that we are going to use:
- clean: This will remove files generated at build-time in a project's directory, we should use this when we want to do a build from scratch.
- validate: This will validate that our POM file is valid and correct, run it when we want to validate that changes in our POM are working, before building or compiling the whole project.
- compile: This will compile our project, but not the tests, it will validate the project first. It will do nothing if the source files have no changes. All phases could be invoked combining them, for example, for a clean compilation we could just run:
mvnw clean compile
- test: This will run the unit tests on our project, it will compile the project, and compile the tests if they have changed, then run our tests and output the results. If compiling does nothing and there is no change in the tests, this phase will do nothing.
- package: This will package our project, ready to be deployed, or installed, before it launches the tests. If they don't pass, the package will fail; so, we can only package if our test passes.
As you can see, the phases are executed sequentially, running package will run all the previous phases.
推薦閱讀
- 從零開始構(gòu)建企業(yè)級RAG系統(tǒng)
- SQL學習指南(第3版)
- Linux C/C++服務器開發(fā)實踐
- Mastering SVG
- vSphere High Performance Cookbook
- 機械工程師Python編程:入門、實戰(zhàn)與進階
- 微信公眾平臺開發(fā):從零基礎到ThinkPHP5高性能框架實踐
- FLL+WRO樂高機器人競賽教程:機械、巡線與PID
- 名師講壇:Spring實戰(zhàn)開發(fā)(Redis+SpringDataJPA+SpringMVC+SpringSecurity)
- Rust Essentials(Second Edition)
- 精通Linux(第2版)
- Haxe Game Development Essentials
- Node.js全程實例
- Learning ArcGIS for Desktop
- Julia High Performance(Second Edition)