Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I trigger a Jenkins job using a Maven dependency?

I have multiple Jenkins Jobs built using Maven:

Job 1: Builds WebApp and deploys war to artifactory
Job 2: Builds Core and deploys jar to artifactory

WebApp has a dependency on Core.

Is it possible for Jenkins to parse the POM, see that WebApp has this dependency on Core and thus triggers Job 2 before building WebApp? This would ensure WebApp uses an up-to-date, latest Core.jar

I can achieve this mechanism via the Jenkins Parameterized Trigger plugin's Pre-Steps feature but I would ideally like to handle this from the POM.

Thanks.

like image 719
Jake Slack Avatar asked Feb 14 '13 10:02

Jake Slack


1 Answers

Yes there is.

  1. you need to set up the jobs as Maven Job

enter image description here

  1. In Job A select the checkbox: Build whenever a snapshot dependency is build.

enter image description here

Apparently this only works, if the dependency is a snapshot dependency.

like image 131
Michael Küller Avatar answered Oct 13 '22 00:10

Michael Küller