Maven error message regarding missing package or class - maven

I have my M2_HOME set to C:\apache-maven-3.2.5\apache-maven\src after reading through the mvn.bat file. It seems that I can now run the mvn command without the M2_HOME error message, but get the following:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Windows\SysWOW64>mvn
Error: Could not find or load main class org.codehaus.plexus.classworlds.launcher.Launcher
C:\Windows\SysWOW64>
yes I acknowledge that I need to run it where I have the POM.xml file to get the dependency etc. information out. Also, I read the similar posts on SO regarding this error message, but it seems like hack and frig job rather than a logical solution.
I know that i would get an error message if i run mvn where I don't have any POM or anything, but the error message is definitely not the above.
I have downloaded maven as a zipped distribution and extracted it on my C:\ drive. My maven folder looks like the following:
C:\apache-maven-3.2.5\apache-maven\(inside there is src\bin)
C:\apache-maven-3.2.5\(Other maven folders and pom.xml)
I don't know if my folder setup is correct.
Any suggestion will be appreciated.
UPDATE
I just realised that I downloaded the source distribution not the binary. I downloaded the correct distribution and it worked fine (with %M2% and %M2_HOME% envvar definitions). Silly things...

You're not supposed to point M2_HOME to C:\apache-maven-3.2.5\apache-maven\src, but rather to an actual installation directory of maven (often C:\apache-maven-3.2.5). What you used is a maven source code folder.
In fact you don't even need maven source code to use maven. Just download one of the binary distribution , point M2_HOME there and include M2_HOME\bin in your shell PATH

Related

How to resolve "test-life cycle-and-artifact Handler1.pom.sha1 " cannot creat on maven installiton

I need your help.
I downloaded maven 3-5-0-src.zip file from maven site. I started to unzip process after a few seconds I got an this error.
Error: System doesn't find this path.
Cannot create
C:\Users\AppData\Local\Temp\wz85b2\apache-maven-3.5.0\maven-core\src\test\resources\org\apache\maven\extension\test-extension-repo\org\apache\maven\core\test\test-lifecycle-and-artifactHandler\1\test-lifecycle-and-artifactHandler-1.pom.sha1.
I can't install maven on my computer. How can solve this?
The ...-src.zip file only contains the source files for your reference.
You need to download and install the binary zip file at apache-maven-3.5.0-bin.zip if you're planning to use maven to build stuff.
Otherwise, the above error looks suspiciously like a Windows path length problem.

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.

Why QOCI plugin isn't working

I am trying to use Qt with QOCI (actually, along with other plugins as well) but for some reason I cannot. Here is what I did and result:
1- http://doc.qt.nokia.com/latest/sql-driver.html#qoci
plug-in is built successfully.
2- copied the plugin debug & release dll and lib files to plugins/sqldrivers and OCI.DLL to %WINDIR%\system32 (plugins/sqldrivers is where other plugins such as QPSQL and QMYSQL are)
3- QSqlDatabase::isDriverAvailable(QOCI) returns false where it returns true for QMYSQL and QPSQL. I did the same for QMYSQL and QPSQL
4- QStringList qsl = QSqlDatabase::drivers();
There is no QOCI in the string list returned. however there is QMYSQL, QPSQL and some others.
additional checks: opened qsqloci4.dll with dependency walker, 3 dlls were impossible to locate: 1-QtCore4.dll 2-QtSql4.dll 3-MSVSC80.dll However it is also impossible to locate them when opening qsqlpsql.dll with dependency walker. I believe that loading dll did not fail because of dependencies of qsqloci4.dll. But still, any ideas are welcomed.
NEWS
LoadLibrary(_T("C:\\QtSDK\\Desktop\\Qt\\4.7.3\\msvc2005\\plugins\\sqldrivers\\qsqloci4.dll");
and
LoadLibrary(_T("C:\\QtSDK\\Desktop\\Qt\\4.7.3\\msvc2005\\plugins\\sqldrivers\\qsqlocid4.dll");
fails!!! Please not that both of those files exist in the given path.
I believe that Qt also cannot load the plugin due to this error. Now question is a bit different but, why does LoadLibrary fail in this case? Any ideas?
Thanks in advance.
How to Build the Plugin on Windows
Choosing the option "Programmer" in the Oracle Client Installer from the Oracle Client Installation CD is sufficient to build the plugin.
Build the plugin as follows (here it is assumed that Oracle Client is installed in C:\oracle):
set INCLUDE=%INCLUDE%;c:\oracle\oci\include
set LIB=%LIB%;c:\oracle\oci\lib\msvc
cd %QTDIR%\src\plugins\sqldrivers\oci
qmake -o Makefile oci.pro
nmake
If you are not using a Microsoft compiler, replace nmake with make in the line above.
When you run your application you will also need to add the oci.dll path to your PATH environment variable:
set PATH=%PATH%;c:\oracle\bin
You need to create a folder call sqldrivers in the directory containing your exe. Put all the SQL driver DLLs you are using in there (for oracle oci.dll, ociw32.dll, oraociei12.dll, oraons.dll, qsqloci4.dll, qsqlocid4.dll).

Resources