Yashima
Yashima

Reputation: 2238

Q: Can I trigger a Jenkins job from a Maven plugin?

The setup is as follows:

Q: Is it possible to automate/merge Steps 2 and 3 in this scenario?

(Building and deploying each takes several minutes)

Upvotes: 0

Views: 682

Answers (2)

JRichardsz
JRichardsz

Reputation: 16495

Yes you can.

I suggest you use webhooks (github, gitlab, bitbucket,...)

Steps will be :

  1. Install some plugin in your jenkins in order to expose a job as public url.
  2. Configure your webhook in git provider adding url created in step 1
  3. Push some changes to your code
  4. Your git provider detect this event and execute the url created in step 1
  5. Your jenkins job is launched. Put your mvn commands and deploy commands in this job. I suggest you use jenkins pipeline job.

Contact me if you need some help.

Post step by step :

https://jrichardsz.github.io/devops/devops-with-git-and-jenkins-using-webhooks

Upvotes: 1

Thiru
Thiru

Reputation: 2699

Yes, you can.

Create a custom goal which will trigger the Jenkins with an URL.

But, ideally, I would suggest to build and deploy using Jenkins by fetching the code from the repository when there is a change

Upvotes: 1

Related Questions