mvn' is not recognized as an internal or external command - windows

I have created these variables with their respective values, but even after doing this, command prompt is not recognizing mvn command
System Variables:
name: M2_HOME
value: C:\Program Files\apache-maven-3.2.1
name: M2
value: %M2_HOME%/bin;
name: path
value: %JAVA_HOME%\bin; %M2_HOME%\bin;

From Maven documentation page:
Maven, like many cross-platform tools, can encounter problems when
there are space characters in important pathnames. The instructions
below will remind you of this for several particular items.
You have Maven installed in C:\Program Files\apache-maven-3.2.1
Try to reinstall it to, for example, C:\maven, or change your current variable M2_HOME to C:\PROGRA~1\apache-maven-3.2.1

I had the same issue.
What I did to resolve this is creating M2_HOME & MAVEN_HOME.
Also, edit Path variable value.
New ->C:\Program Files\Apache Software Foundation\apache-maven-3.6.0\bin
where Apache Software Foundation is a folder I created to extract the apache-maven-3.6.0-bin.zip file.
Also, make sure Java is working fine and JAVA_HOME is properly set.

try :
to restart the command prompt
to start the command prompt with run/cmd instead of shift+right-click -"open command window here"
to put the system path between double quote to manage espace character
to replace C:\Program Files\ per C:\PROGRA~1\
edit
this is my own config :
MAVEN_HOME="C:\Program Files\apache-maven-3.2.1"
PATH=XXX;%MAVEN_HOME%\bin;XXX

Hello I had the same problem and I figured it out that I was including some space characters on the "path" next to the ; just by removing the space character I was able to have everything working properly"

this is the settings for my maven.
name: MVN_HOME
value: C:\Program Files\apache-maven-3.2.1
name: path -> add the following value(just the maven part)
value: %JAVA_HOME%\bin;%MVN_HOME%\bin; -> this should have no spaces

I have a very difficult time to solve this problem. It did not work no matter how I set up the environment variables in the control panel of Win7.
My final solution is to set the variables via the cmd.
set M2_HOME "D:\Program Files\Maven\apache-maven-3.3.3"
set M2=%M2_HOME%\bin
set path=%path%;%M2%

I think you have a typo:
change
name: M2
value: %M2_HOME%/bin;
to
name: M2
value: %M2_HOME%\bin;
if it doesn't work change %M2_HOME%\bin with the path.
in this case:
C:\Program Files\apache-maven-3.2.1\bin

Make sure to set the path under the System Variables and not User Variables.

In my case, for reasons I cannot explain, it made a difference to windows 7 if the MAVEN_HOME environment variable was defined in "System Variables" vs "User Variables".
I originally had both JAVA_HOME and MAVEN_HOME as "User Variables" and "Java -version" worked but windows could not find mvn (My path variable looked like this in both cases "Path=C:\Program Files\Java\jre1.8.0_144\bin;E:\Clif\Java\apache-maven-3.6.0\bin;")
Once I changed both Environment variables from "User Variables" to "System Variables" windows was able to find mvn.

I was using %MAVEN_HOME% in the variable path and it was giving problem, even though echo %MAVEN_HOME% command was showing the right path.
I changed it to C:\Program Files\apache-maven-3.6.1\bin in the path (Depends on your version of-course) and it worked like a charm.

Related

Setting environment variable with WiX, losing filename at end of path

I am utilizing the WiX "Environment" element to set an environment variable.
<Environment Action="create" Name="My_Certificates" System="yes" Id="certificate_env" Value="[CERT_XML_PATH]" Permanent="yes" />
CERT_XML_PATH gets set to the following: c:\this\is\my\path\myfile.xml
If that file actually exists, the environment variable is set properly and points to the file.
If that particular file doesn't exist at the time of the install, the environment variable is created and set, but the path is truncated to remove the myfile.xml portion.
This installer is part of a larger suite. It has its own standalone MSI. Installing one of the packages creates this xml file, but not the particular one I'm working on. If the xml file has been created, everything works fine. But if this installer is ran first, it will set the environment variable to
The environment variable "My_Certificates" gets created, but set to:
c:\this\is\my\path\
Instead of:
c:\this\is\my\path\myfile.xml
Troubleshooting:
The install log shows the property being set to the proper location.
MSI (s) (70:80) [15:27:44:988]: PROPERTY CHANGE: Adding CERT_XML_PATH property. Its value is 'c:\this\is\my\path\myfile.xml'.
Then we see the installer doing a WriteEnvironmentStrings a utilizing the proper path, including the xml file.
MSI (s) (70:80) [15:27:50:644]: Executing op: UpdateEnvironmentStrings(Name=My_Certificates,Value=c:\this\is\my\path\myfile.xml,Delimiter=[~],Action=536870914,)
WriteEnvironmentStrings: Name: My_Certificates, Value: c:\this\is\my\path\myfile.xml, Action 536870914
screen shot of system variables showing it not set properly
Any insight into why the file name is being truncated would be greatly appreciated.
Found the issue. There is a custom action in the installer that is also trying to set the Environment Variable. When disabling that custom action, everything works as intended.

How get project parent directory in pom.xml

In maven set path to chrome driver as:
<driver.chrome>${project.basedir}/../repo</driver.chrome>
As result path is: D:\MyProj\..\repo
Answer: driver.chrome>file://${project.basedir}\..\repo</driver.chrome>
OK, I think I understand what you're asking. The resulting path you're getting is not minimized, but as far as I know, it is a valid path and it would work on any operating system.
In other words - D:\MyProj\..\repo is valid and equivalent to D:\repo. Go ahead and try to paste it into Windows Explorer and see if it opens it. Or cd to it in command prompt.

Error when Installing pentaho data integration

I'm trying to install pentaho data integration and I have a problem with the configuration of spoon.bat. I updated the file with adding PENTAHO_JAVA= javaw.exe, also edited the environment variables (Computer > Properties > Advanced > Environment Variables by adding ";C:\Program Files\Java\jre7\bin" on the end of the variable PATH.
but when I start the file, it doesn't work.
I have this error
DEBUG: Using JAVA_HOME
and Windows can't find the path
JAVA_HOME should be pointed to a jdk. JRE_HOME should point to jre.
JAVA_HOME = C:\Program Files\Java\jdk\bin
JRE_HOME = C:\Program Files\Java\jre7\bin
PENTAHO_JAVA = 'C:\Pentaho\Java'
Change the paths accordingly and try.

Maven Path Variable Issue

I am having issues running mvn --version anywhere outside of C:\Program Files\Apache Software Foundation\apache-maven-3.2.1\bin. If I run mvn --version inside the apache-maven/bin folder I get the version number, however if I run it anywhere outside it says will not recognize mvn.
Am I missing something in my path variables?
My System Variables:
M2 = %M2_HOME%\bin
M2_HOME = C:\Program Files\Apache Software Foundation\apache-maven-3.2.1
JAVA_HOME = C:\Program Files\Java\jdk1.7.0_51
I appended
Path = ; %M2%
My User Variables:
M2 = %M2_HOME%\bin
M2_HOME = C:\Program Files\Apache Software Foundation\apache-maven-3.2.1
JAVA_HOME = C:\Program Files\Java\jdk1.7.0_51
Thanks
You have to define variables before you use them. Change the order of the first two lines in your first example, and set PATH, not Path.

Issue with dotNerInstaller Getting error "The installation package could not be opened. Verify..."

When I create exe within the C:\Program Files\dotNetInstaller\bin folder, and run it, it works perfect, install perfect, but when I try to install that exe from any other location/path, the error appears "The installation package could not be opened. Verify that the package exists and that you can access it. etc....."
I created an exe and moved to another XP system, on that system, it again gives me error ?
whats the solution ? Is there any admin rights issue ?
I have tried with both TRUE and FALSE of Administrator_Required option.
any idea how can I solve this issue ?
The issue is resolved now.
I should have written #CABPATH\ in the MSI->Package field. Before I was writing #TEMPPATH\
I think you can should add the location:
C:\Program Files\dotNetInstaller\bin
in the PATH environment variable. Follow the steps: Go to
My Computer->Right click->Properties->Advanced System Settings
->Click Environmental Variables. Now click PATH and then click EDIT.
In the variable value field, go to the end and append ';' (without quotes) and then add the above path.

Resources