Conditional build

I have 2 maven projects that are in the same svn tree. 1 has a depenency on the other. Let's call it the sub-module.

The sub-module doesn't change very often and it takes a long time to compile and build (thanks to gwt).

I'd like to have the sub-module build automatically if and only if there is a change to it.
I'd also like to have the main build be dependent on the sub module, so that if the sub module does change the build will pick it up immediately.
This will prevent me from have build failures when someone checks in changes to both.

The closest I've come to this setup is the following:

Main build is depending on the sub module build.
The sub module only checks out the files it needs to build.
Then it doesn't build if those file don't change.

The problem is that there are some shared config files that are needed for build but shouldn't trigger a sub module build.
I tried setting the build triggers on the Sub Module, but since it is a Main Build dependency it gets triggered anyway.

Does anybody know of a different approach?

Douglas

4 comments
Comment actions Permalink

I've been reading through the forum and thinking about this more and the best I can come up with is to remove the maven step from the sub module build
and instead make a command line step. In the command line I can check by conditions and only run maven when appropriate.

Anybody know of another way to do this?

Also, I know how to setup a dependency so that another build will get kicked off when a build is run but is it possible to run another build once a build complete successfully?
I.E. A downstream dependency.

Douglas

0
Comment actions Permalink

Hi Douglas

This is quite complex scenario, so I think your solution is good.
Alternate approach is to move shared code into 3rd build configuration and pass it to other builds as artifacts. But it makes setup even more complicated.

There is Finish Build Trigger that allows to start a build immediately after another one. But it does not guarantie source synchronization - snapshot dependencies ensure that all the builds in the chain use sources from the same point of time.

0
Comment actions Permalink

Thanks Michael.

Here's be break down

1) Build Widgetset if needed
2) Build App
3) Run Selenium Tests (This is just an ant task that install a build artifact and then runs the tests, I just install the latest build, so I don't have to worry about source synchronization).

As for the Finish Build Trigger that sounds perfect. I'll try to find it.
Does it always run when the build finishes or only when it if finishes without a failure?



Douglas

0
Comment actions Permalink

As for the Finish Build Trigger that sounds perfect. I'll try to find it.
Does it always run when the build finishes or only when it if finishes without a failure?

There is an option, it's up to you to decide:
Capture.PNG

0

Please sign in to leave a comment.