Maven - "files were unexpected at this time"

I am trying to install maven on my computer (windows 7)

Below are the steps that I have taken.

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. 

Get the following error.

Files were unexpected at this time.

What is wrong here? Please help me solve this problem.

Thanks in advance!

** Note. I do not use quotation marks for any of the paths here. I also tried with 8 char syntax for folder names as follows:

set java_home = "c: \ Progra ~ 1 \ Java"

The problems were not resolved. Read the steps I added and help me solve this problem. **

+8
source share
4 answers

Finally, I was able to solve the problem.

The set value in user variables caused the "Files were unexpected at this time" error in maven.

I spent a lot of time modifying the 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" 

Removed the quotes and changed the git home variable as shown below, and now everything works fine. :)

 Home = C:\Program Files (x86)\Git\bin 

There was an error here:> </a> </p></div></body> </html>

+20
source

I had a similar problem
Files\apache-maven-3.3.9""=="" was unexpected at this time.
and when I looked at the "Environment Variables" inside the "System Properties", there were no quotation marks (") inside any variables, but before that I followed the manual and set these values ​​using cmd:
C:\Program Files\apache-maven-3.3.9\bin>set M2_HOME="C:\Program Files\apache-maven-3.3.9"
So, to fix this, I just restart the following in cmd:
C:\Program Files\apache-maven-3.3.9\bin>set M2_HOME=C:\Program Files\apache-maven-3.3.9
(removed from cmd destination) Hope this helps someone.

+1
source

Try to add

 C:\Program Files\apache-maven-3.3.3\apache-maven-3.3.3\bin 

to PATH variable

0
source

I ran into the same problem in jenkins when I asked jenkins to install maven inside. Note the double quotes below when jenkins build

  '""C:\Program Files (x86)\Jenkins\tools\hudson.tasks.Maven_MavenInstallation\maven\bin\mvn.cmd"' -f ./Voyager/pom.xml clean package.... 

To solve this problem, I downloaded Maven and manually set the path in jenkins, and it was solved.

0
source

Source: https://habr.com/ru/post/1239983/


All Articles