What is the difference between Maven and Jenkins?

JavaMavenJenkins

Java Problem Overview


What is the difference between Maven and Jenkins?

Both support automated builds and automated execution of JUnits.

If so, are they complimentary, or mutually exclusive? When should onebe used over the other?

Java Solutions


Solution 1 - Java

Maven is building tool/environment. Jenkins is a CI (continuous integration) tool.

Maven is more like a replacement for Ant.

  1. It assists building of the project through plugins e.g build and version control, JUnit tests, etc...
  2. It manages dependencies of your project. you define how a project should be built(plugins), and what libraries are needed (dependencies) in a pom.xml file.

Jenkins as a smart job scheduler, can not assists you with tasks like version control or JUnit test, however it can indirectly assists you with all this, by making calls to the pom.xml file in your project. And Jenkins gives you the power to decide when to call the pom.xml file, based on what condition to call, and what you want to do with the outcome. and Jenkins can listen to different events, e.g svn commit, current time is midnight etc..

This is a powerful idea. For example, you can ask Jenkins to trigger a build or run through all JUnit tests whenever a new code is committed and then, if the unit tests are passed, deploy on a target machine. or schedule heavy tasks at midnight e.g unit tests.This is the basic idea of auto deployment or AKA continuous integration. CI for short if you like.

Solution 2 - Java

Maven is a build tool that manages dependencies and the application life cycle. It also had a plug in design that allows you to add other tasks to the standard compile/test/package/install/deploy tasks.

Jenkins is a continuous integration suite that checks your code out of a repository, builds and packages it, and dumps it out to a server so you can test it - all hands-off. It can use Maven or Ant as its build tool.

In summary, Jenkins can use Maven as its build tool for continuous integration. You can use Maven without Jenkins if you choose not to do CI.

Solution 3 - Java

The first paragraph of the Jenkins Maven plugin wiki page explains the interaction between Jenkins and Maven:

> "Managing Jenkins jobs is not easy when there are many of them, especially if certain parameters should be identical among many jobs. "jenkins-maven-plugin" allows to generate Jenkins jobs, one "config.xml" per job, from a simple Maven POM. This way we can have all Jenkins jobs controlled in one place, reusing any amount of configuration between them."

Solution 4 - Java

Maven is a build tool, in short a successor of ant. It helps in build and version control.

However Jenkins is continuous integration system, where in maven is used for build. Jenkins can be used to automate the deployment process. When ever the new code is committed, automatically run all Junit test cases and if they're passed, package and deploy the project to the specific location.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionabsonView Question on Stackoverflow
Solution 1 - JavaJunchen LiuView Answer on Stackoverflow
Solution 2 - JavaduffymoView Answer on Stackoverflow
Solution 3 - JavaDavidSView Answer on Stackoverflow
Solution 4 - JavaPreetham R UView Answer on Stackoverflow