Configure Maven installation in Jenkins per individual job - maven

Is there a way to configure Jenkins to use specific Maven installation per job?
e.g.
Job A - Maven 3.3.3
Job B - Maven 3.3.9

Jenkins allows you to select which Maven installation to use per job. You can setup multiple installations of Maven, multiple settings configurations of Maven to be exact, through Manage Jenkins → Configure System.
Then to configure per job, in Jenkins, select your specific build job and choose Configure. From there, assuming it is a Maven project build, you should have option(s) under the Build section (might have to hit the Advanced button) where you can select the Maven settings for your installation you want.
khmarbaise's comment is very valid, though. Unless you have a very specific reason to downgrade Maven for a given job, your build shouldn't be too reliant on what minor versions of the build tool to use.

For newer Jenkins versions, management of Maven installations is placed here:
Manage Jenkins → Global Tool Configuration → section Maven.
Per job configuration: "Maven Version" dropdown placed in "Build" section.

Related

Jenkins needs to know where your Maven is installed

Jenkins runs into error while locating "maven" folder, for Maven type project:
Jenkins needs to know where your Maven is installed. Please do so from the system configuration.
Just about the place where pom.xml location is to be mentioned.
As stated in the above answer, you need to set-up maven in Global Tool Configuration. Name your Maven & check the install automatically option. Jenkins will automatically install Maven before building the project
As mentioned in Bug JENKINS-34743, you need to set Maven Location in Global Tool Configuration = Jenkins initial page > Manage Jenkins > Global Tool Configuration

Publish JavaDoc on Jenkins with maven

I have maven project that is built by Jenkins-CI.
How to generate and publish JavaDoc on Jenkins?
Make sure Jenkins javadoc plugin is installed.
Go to http://yourjenkinsserver.com/jenkins/pluginManager/installed to see list of intalled plugins.
Plugin page https://wiki.jenkins-ci.org/display/JENKINS/Javadoc+Plugin
Configure Jenkins job:
In Build section, Goals and options line add:
javadoc:javadoc
That's all. No need to change pom.xml
The simplest thing to do is to create a separate task that runs thr javadoc command, and which runs after the compile task. You pass it the input and output directories.
I would run a separate tomcat for your CI website - it's easier.

Set up a project runner in Teamcity to deploy build artifacts to Artifactory

In our web-application we manage our continuous integration using TeamCity. So far we have manually added required jars and used an ant script to build and deploy our application. Lately we switched to Maven and added Artifactory to the cycle.
I need to know how to deploy our build artifacts from TeamCity to Artifactory.
I added the Artifactory plugin to TeamCity (following this guide) but when trying to add a new build step I can't seem to find any Artifactory related step (which I expect to find).
Am missing something here?
I don't think it is a separate step but actually a set of options at the end of the Maven build step itself (it should be toward the bottom).
See here for more detail:
http://wiki.jfrog.org/confluence/display/RTF/TeamCity+Artifactory+Plug-in.
Specifically, it says "The 'Deploy maven artifacts' option will only be available when using a 'Maven2' build runner."

How to block local release of the eclipse made for artifactory repository

I´m working with Maven 3, eclipse Helios and Jenkins e Artifactory. During the execution of release plugin one of the steps that this plugin is doing, is publish in artifactory the generated release. In my organization, we have the following issue:
Only the manage of configuration can run the release through Jenkins with release-plugin, but any developer can run the release plugin through console and this execution will overwrite the release published in artifactory.
I´m looking around artifactory configurations and all developer users are with read permissions but they can update release local in artifactory.
There are any solution to block or disable the execution of local release from eclipse through Jenkins?
Thanks if anyone can help me!
I would suggets using Artifactory's release management for Jenkins, which is part of the Jenkins Artifactory plugin.
This will allow you to run release management purely from Jenkins, possibly with a dedicated user, and also run staging and promotion on releases.
Releasing/staging would typically be done to a dedicated repo in Artifactory which only the Jenkins release user has write permissions for.
The release management functionality in the Jenkins Artifactory plugin is a complete replacement for the maven release plugin (and for the Jenkins m2release plugin which is based on the latter), that is:
Faster and involves less (unnecessary) rebuild cycles
Integrates your existing Maven and SCM Jenkins configs
More flexible in how versions can be applied
Offers robust rollbacks
Also works for non-Maven build types
Move release plugin to profile (it should not be activate by default). Activate profile only when you run build on jenkins. (for profile name jenkins use mvn <goals> -Pjenkins)
http://wiki.jfrog.org/confluence/display/RTF/Managing+Permissions

How to configure Hudson to use Maven for dependecies and run JUnit

In Eclipse I have my "Dynamic Web Project" configured with Maven taking care automatically of all my dependencies (once I specify them in pom.xml). After implementing my Unit Tests I can simply run them all by right-clicking on project and selecting: Run As -> JUnit Test.
How/where can I now configure Hudson so after checkout of all my sources from SVN repository it would automatically invoke(?) Maven (to download all dependencies) and then run all available tests with JUnit?
When you set up a project in Hudson (now Jenkins) in the configuration page you may choose the build phases that Jenkins will run. Then it will run them in the order you specify. There you will have Maven steps where you'll define your goals.
Jenkins itself has to know where to find a Maven installation (or Ant, or any other command that it must run to build). This could be done in the server configuration page.
I think that's the default behavior of Hudson (compiling + running tests).
Did you commit on your svn repository the pom.xml file?

Resources