maven package/skip a module
The project modules structure is as follows:
my-project ├── common-api │ ├── common-domain │ ├── common-datasource │ └── modules │ ├── module-AA │ ├── module-BB │ └── module-CC
maven skips a module for compilation and installation
need:For some reasons, the code of modules-BB module has been modified. This module has reported an error and cannot be compiled, installed and executed temporarily. This module needs to be skipped for compilation and installation.
solve:
mvn clean install -pl !modules/module-BB -am
maven only compiles and installs a certain module
need:If there are many modules, the maven install process is long. How to compile only one module to be executed when installing it
solve:Only compile and install module-AA
mvn clean install -pl modules/module-AA -am
Build module-AA separately, and build other modules that depend on module-AA at the same time
mvn clean install -pl modules/module-AA -amd
Command explanation:
clean | Cleaning up the project |
install | Installation project |
-pl | Select the project you want to build, separated by commas |
-am | Build a specified module, and build other modules that the specified module depends on at the same time |
-amd | Build a specified module, and build other modules that depend on the specified module, including transitive dependencies |
- | Skip the test, otherwise all test classes must be executed and must be passed correctly |
Summarize
The above is personal experience. I hope you can give you a reference and I hope you can support me more.