Jenkins + Maven Manual Installation - maven

I installed Jenkins on to 2 new machines no-problemo!
But, when attempting to integrate Maven, I am having "command not found" in my Jenkins log, yet I can run mvn no problem in the command line.
So, I thought it was a PATH issue - so I added the /bin and also the / (of the location where Maven is extracted to), yet I'm still getting the error.
I tried adding the PATH to my ~/.bash_profile as well, so my current PATH is:
$PATH:/usr/local/bin:/Users/jenkins/apache-maven-3.5.2/bin:/Users/jenkins/apache-maven-3.5.2
Still, Jenkins will not find Maven. I do NOT want to globally install Maven, as it may affect the other 5 build servers we have that are working with Maven correctly (not sure how it's working).

The issue was resolved by simply re-connecting the Jenkins Slave. Thanks for your feedback!

Related

Error while run the maven framework through command prompt but it's running fine with eclipse

I faced the issue with the surefire plugin "2.19.1" as below. I have tried with the version 2.19.1,2.12.4,3.0.0-M1
You're maven seems to be corrupt. Assuming you're on a windows machine:
1) set M2_HOME environment variable to the folder where maven is. (if in doubt download it and put it somewhere, it's just a java program.
2) set JAVA_HOME environment variable to the folder where your java is.
3) add %JAVA_HOME%/bin:%M2_HOME%/bin to the start of your PATH environment variable.
4) Make sure your ~/.m2/ folder has a settings.xml in it, you can use the one from the maven download to start. (you may need to add the proxy details)
5) Test with
mvn -version
6) You can clear your local repository by deleting files in ~/.m2/repository if you've not done much and have a reasonable network just blow the whole thing away.

Jenkins ERROR: Failed to parse POMs java.io.IOException: Cannot run program error=2, No such file or directory

In jenkins I am forcing the execution to happen in one of the slaves.
in jenkins configuration I have updated the JAVA_HOME and MAVEN location to the location where its installed in the slave. When I start the build in jenkins I receive the following error
ERROR: Failed to parse POMs
java.io.IOException: Cannot run program "/home/jmeter/jdk1.8.0_112/bin/java" (in directory "/home/jmeter/apache-jmeter-2.13/bin/workspace/MyProject"): error=2, No such file or directory
PS : /home/jmeter/apache-jmeter-2.13/bin/workspace/MyProject - This directory got created and does exist in the slave machine
Can someone please share their expertise in resolving it ?
I needed to add Tool location of JDK8 for machine i run test on.
looks like there is a problem in the MVN installation. PLS make sure in the global config that you have the required mvn installation.
jenkins-->manage-->configure look for Maven installations and use automatic installation for the required version
make sure you have the JDK installation in the same config file
After wasting one day trying with different things going through different suggestions I got nothing. But, it was actually very simple. Please add the JDK path as bellow to your JDK Path in Jenkins-
/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home
You should assign the JDK in the Meta Data,The JAVA_HOME of system is not work for build.
Check your Maven version selected into the Manage Jenkins->Global Configurations->Maven->Maven Installations->Install from Apache->Version is same as installed on the server and your maven project.
You might have left out a few dependencies resulting in this issue.
Go back and download java and set the path as before:
To download, use
$yum -y install java-1.8*
Set the path to
JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.242.b08-0.amzn2.0.1.x86_64
Note: Get your path using command
find /usr/lib/jvm/java-1.8* | head -n 3
This got resolved after adding maven_home and providing the path in the global properties.
Go to: Jenkins ⟶ Manage Jenkins ⟶ Global Properties ⟶ MAVEN_HOME [C:\Program Files\Apache\apache-maven-3.6.3-bin\apache-maven-3.6.3]
Just in case someone else runs into this. I was getting this error because someone setup the JDK in Global Tool Configuration to download a windows version of the JDK, but my instance of jenkins is running on linux. Once I made the change to use a linux version of the JDK my issue was resolved.

Apache Maven is not configured properly into System vairable

I have latest version of Apache Maven 3.3.9 residing in my drive downloaded from here. I need it for configuring Appium tool to perform automated testing of Android applications. I have Maven plugin already configured with my Eclipse IDE. I went through few articles and got to know that I have to configure Maven into system variables as well. I set system variables, path for it as below.
M2HOME = C:\Program Files (x86)\Apache\apache-maven-3.3.9
M2 = %M2HOME%\bin
path = C:\Program Files\Java\jdk1.8.0_31\bin;%M2%
I tried running mvn , mvn -version from cmd prompt to check successful configuration of Maven but it gave me nothing. I tried navigating to the bin folder and re run the command but still the result is same. I even changed my path variable to have absolute path of Apache Maven i.e path = C:\Program Files (x86)\Apache\apache-maven-3.3.9\bin
To be further sure I copied the Apache Maven to a different folder just because it had spaces in between Program Files and Program Files (x86) but still the command prompt is as below:
I had followed above steps referring various articles in google. I'm not getting if I have committed any unseen mistake.
P.S: I have even tried above commands with cmd running as an administrator
Try mvn --version (with two dashes). mvn -v should also work. If Maven is not being executed at all, I suggest you try mvn.bat.
Some Command Prompt configurations will refuse to run .bat-files without the extension unless you explicitly tell them to.
It's probably a good idea to run where mvn in your Command Prompt as well. You should get this:
<YOUR_MAVEN_HOME>\bin\mvn
<YOUR_MAVEN_HOME>\bin\mvn.bat
<YOUR_MAVEN_HOME>\bin\mvn.cmd
if everything it set up correctly.
You should define M2_HOME variable. (Not M2HOME). Make sure it looks like this:
You said that you copied your maven to the location without spaces. That's a good idea. But it looks like your Path system variable points to the old location of maven. Make sure to change it. (What is the current location of maven?)
BTW mvn -version works as well as mvn --version

Couldn’t find any executable in apache-maven-3.3.3

I have a windows jenkins slave and I have download apache-maven-3.3.3 on it.
It is located C:\Users\myUsername\Desktop\apache-maven-3.3.3 This is copy and pasted from the windows explorer on my Windows slave.
Then when I point at this location in Jenkins and run a build. I get this error
Couldn’t find any executable in C:\Users\myUsername\Desktop\apache-maven-3.3.3
I have also tried Couldn’t find any executable in C:\Users\myUsername\Desktop\apache-maven-3.3.3\bin
This works just fine on my linux slaves. What is the difference? Why is this not working?
Maven changed the name of the executable in Maven 3.3 from mvn.bat to mvn.cmd. Jenkins recognized mvn.cmd since Jenkins 1.613 (see this commit). If you are on an earlier Jenkins version you can add a symlink from mvn.bat to mvn.cmd on windows as a workaround.
The executable is in the \bin folder (namely, mvn.bat). Try to point Jenkins to C:\Users\myUsername\Desktop\apache-maven-3.3.3\bin
First
Under your Windows machine
1. create an Environment Virable named MAVEN_HOME and set its value to C:\Users\myUsername\Desktop\apache-maven-3.3.3.
2. Add %MAVEN_HOME%\bin into your System PATH
Second
Go to
http://your-jenkins-server/computer/your-windows-slave/configure -->Node Properties-->Tool Locations-->(Maven)maven
and set its value to C:\Users\myUsername\Desktop\apache-maven-3.3.3 as well.
Third
Reconnect your jenkins slave, then rerun your job.
Well for me it was wrong setting for maven. Go to configure, under post build action, go to advanced setting and there fix the Maven version to be used, i changed it to maven 3.3.3 and it worked.
I am using Windows. The accepted answers does not work for me. So, I have to create a new Maven in Jenkins and select the option "Install automatically". Then it works.

Jenkins corrupted, need to know which files I need

I am having issues with Jenkins that I am unable to resolve, and all the solutions I've found online I've used in the past, but are not helping.
I am on windows 2008r2, utilizing svn, jenkins version 1.407.
Initially the service failed, and was not resolved with past methods. In the past I have successfully troubleshoot Jenkins by killing hung processes, restoring the war file, ect.
I have attempted a new install with bringing over the files in the jobs folder. The end result was a partially functioning Jenkins would attempt a build it would report no change and not update.
What I'm trying to determine is a list of files/folders beyond the jobs folder that I need to move to the new install. The initial install predates me and was Hudson. The folder has a number of obviously obsolete files and folders (both a jenkins.war and a hudson.war)
Go to Jenkins home folder and collect:
all ./*.xml files in - these are configuration files for plugins and jenkins itself
users/* in case you have security enabled
subversion-credentials/** and secrets/** for any kind of keys provided in jenkins to access svn or other resources
plugins/*.*pi folder for all plugins - you don't need to have the unpacked folders
jobs/*/config.xml - to retrieve all job configurations; jobs/*/nextBuildNumber if you care to continue build numbers
plugins may create additional folders which you may want to use
with that you should recreate Jenkins as it was. Pay especially attention to config.xml file in root folder - this holds main jenkins configuration. If your issue reproduces on new system most likely a plugin is cause for problems - in that case review log files most likely you will find out which plugin causes trouble.
You didn't indicate if you tried new setup with same version of Jenkins or newer one; if you are using newest version it may be that ssh key handling / svn authentication for each job needs to be updated as somewhen in last few months authentication / security handling changed. Best is to look into Jenkins release log.
I'm using Jenkins 1.55x on CentOS installed as RPM; given that it is a webapp I assume Windows 1.4x setup is similar.

Resources