How does Jenkins build a maven multi-module project?

I have a springboot project of maven
this project has multiple modules, one parent pom, one api module, and then other modules rely on api module
configure jenkins
because this maven multi-module project is uploaded in the same git repository
, so they are unified as a project
project. In fact, they are also divided into modules
, but each module can only compile
, not set Post Steps (. My step is to compile and generate jar package. Then move the jar package in post steps to a directory under linux, and then run the jar package)
can only set
under project. For example, if I have an order module to upgrade and update, I cannot move the order.jar package to the order directory under linux alone, and then run the jar package

.

my plan is:
1 build as many jenkins project, as there are separate modules, but only compile a module in Goals and options, and then the script in Post Steps only deals with that module
I think the problem is that every project will have a copy of the project source code, which is wasteful

2 each module sets up a git repository, so that in jenkins, each project manages only one module"s git, but how to solve the problem that each module depends on parent pom and api modules?

Mar.24,2021
Has the problem of

been solved? I am also a built maven project. If I use the modules in jenkins to build separately, I will report an error. I read the executed maven instruction and added the parameter-N-B-f. It seems that there is no resolution of the dependency relationship between maven modules. Can you successfully build separately using modules using jenkins?


own dependency, either get a private server, or install to the machine running Jenkins
personal view maven multi-module is more suitable for the library, not suitable for service


put the dependent module as a lib library jar package into your new module. When you need to run, maven will look for dependency packages under claaspath in manifest.mf, which can also be managed by Nexus or micro-services.


in the new version of Jenkins
create a new freestyleproject project
for example, this configuration can solve your problem
image.png

Menu