Multimodule maven build

Answered

Dear all,

I was wondering what's the proper way to configure the following situation. I have a multi module  maven project:

 

module A, module B and module C which is common for A and B.

 

I'm using the following setting in order to build only modules that were changed:

Enable incremental building:

 Build only modules affected by changes

For each of the modules A and B I want to have a build config that will make a deployment (it is a custom Build Feature not editable by me). 

 

My problem is that I do not know how to trigger a specific deployment build depending on the artifact produced by the maven build. For example if maven build produces only A.jar i want only A deployment to be triggered. If i connect them by Finish Build Trigger then one of them will fail because of the missing artifact.

 

What's the proper way to handle it?

 

 

0
4 comments

The proper way is to have different build configurations for the deployment of different jars. If they all have to be deployed together at the same time, then you can do it with one, but if you want to deploy one at a time, then simply add an extra step or build configuration after the end of the build process of each jar and it will deploy only that package.

You can also script your way through instead of using dependencies, picking them up manually and identifying which one changed, but it's a lot of work.

Edit: Just a bit of extra information. The deployment in this situation will typically be a build template inherited from two separate configurations, one for A and one for B, so that most of the configuration is common, it just will change the dependencies, etc.

0
Avatar
Permanently deleted user

Thank you Denis,

I understand that for the deployment I need different build configurations after the build process. My concern is that the build process is common for both of these deployments. So I have one build configuration that consists of maven build step with the incremental building enabled. This allows me to produce only the jars that were changed from the previous build.

The problem is how to trigger deployment A build configuration only if build process produced A.jar and deployment B build configuration only if build process produced B.jar.

 

From what I understood you suggest me creating different build process for each of the module. But again how to trigger it only if the change is affecting this particular module.

 

 

0

I have the same question. How does "incremental building" work when I have snapshot dependencies?

0

Hi navkast. In the use case described by OP, he could trigger A, B, or both from a build step in C via REST API. I'm afraid having a snapshot + artifact dependency on C in both A and B will not work very well. The reason is if C only produces A.jar but not B.jar, artifact dependency in configuration B will fail. And currently, there is no optional artifact dependency. Therefore when B is triggered and B.jar is missing, configuration B will fail.

0

Please sign in to leave a comment.