Maven-“文件在这时是意外的" [英] Maven - "files was unexpected at this time"
问题描述
我正在尝试将Maven安装到我的PC.(Windows 7)
I'm trying to install maven to my PC.(windows 7)
以下是我完成的步骤.
1. Installed Java 1.8.0.11
2. Added a system variable JAVA_HOME = C:\Program Files\Java\jdk1.8.0_11
3. Appended it to the path - PATH=%JAVA_HOME%\bin;C:\Program Files\......;... etc
4. Typed "Java -version" in command line and got the java version details as usual.
5. Then I downloaded and extracted the Maven 3.3.3
6. Added the M2_HOME to system variable.M2_HOME=C:\Program Files\apache-maven-3.3.3\apache-maven-3.3.3
7. Added M2 Variable M2=%M2_HOME%\bin
8. Appended M2 to Path variable. PATH=%M2%;%JAVA_HOME%\bin;....;...etc
9. Typed mvn --version in command line.
出现以下错误.
文件在此时是意外的.
Files was unexpected at this time.
这是怎么了? 请帮助我解决此问题.
What is wrong here? Please help me to get this resolved.
提前谢谢!
**注意-我这里的任何路径都没有使用引号.我也尝试使用8 char语法来表示这样的文件夹名称:
**Note - I have not use quotes for any of the paths here. also I tried with 8 char syntax for folder names like this:
设置java_home ="c:\ Progra〜1 \ Java"
set java_home="c:\Progra~1\Java"
这些都没有解决问题.请阅读我添加的步骤,并帮助我解决此问题.**
Non of these were resolved the issue. Please read the steps I have added and help me to get this resolved.**
推荐答案
最后,我能够解决该问题.
Finally I was able to resolved the issue.
用户变量中带引号的值导致maven中出现此时文件意外"错误.
A quoted value in the user variables has caused to the "Files were unexpected at this time" error in maven.
我花了几个小时的时间来更改Java_home和M2_home变量的不同组合,但最终检查了用户变量并记下了引号.
I spent hours of time with changing Java_home and M2_home variables with different combinations but finally checked the user variable and noted the quotes there.
Home = "C:\Program Files (x86)\Git\bin"
删除引号并如下更改git home变量,现在一切正常. :)
Removed the quotes and change the git home variable as below and now all works fine. :)
Home = C:\Program Files (x86)\Git\bin
这篇关于Maven-“文件在这时是意外的"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!