Maven M2_HOME设置为无效目录(Windows 7) [英] Maven M2_HOME set to an invalid directory (Windows 7)

查看:798
本文介绍了Maven M2_HOME设置为无效目录(Windows 7)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我曾尝试将Maven安装到Windows 7,但效果不佳.一些基本信息:

I've tried installing Maven to Windows 7 with poor results. Some basic info:

Maven安装目录:C:\Program Files\Apache Software Foundation\apache-maven-3.0.4 系统变量"M2_HOME":C:\Program Files\Apache Software Foundation\apache-maven-3.0.4\ 系统变量"Path":%M2_HOME%apache-maven\src\bin;%JAVA_HOME%\bin

Maven installation directory: C:\Program Files\Apache Software Foundation\apache-maven-3.0.4 System Variable "M2_HOME": C:\Program Files\Apache Software Foundation\apache-maven-3.0.4\ System Variable "Path" : %M2_HOME%apache-maven\src\bin;%JAVA_HOME%\bin

如果我在命令路径中运行mvn --version,则会收到错误消息:

If I run mvn --version in the command path, I get the error message:

请在您的环境中设置M2_HOME变量以匹配Maven安装的位置

Please set the M2_HOME variable in your environment to match the location of the Maven installation

因此,目前未按照说明设置mvn的子目录,该子目录为%M2_HOME%\bin.如果我用那个替换%M2_HOME%apache-maven\src\bin,我得到:

So at the moment the subdirectory for mvn is not set according to the instructions, which would be %M2_HOME%\bin. If I replace %M2_HOME%apache-maven\src\bin with that one, I get:

mvn无法识别为内部或外部命令,可操作程序或批处理文件

mvn is not recognized as an internal or external command, operable program or batch file

在Maven安装目录(或zip文件)中,直接在apache-maven-3.0.4中没有\bin文件夹,我想知道是否应该有一个文件夹?

In the Maven installation directory (or in the zip-file) there is no \bin folder directly in apache-maven-3.0.4 and I wonder if there should be one?

我是Maven的新手,希望你们能为您提供帮助.

I'm a complete novice to Maven, hopefully you guys can help.

通过Java命令可从任何目录工作的方式,所以我认为这不是问题所在,但我不确定.

By the way the Java command works from any directory, so I don't think that's the issue here, but I can't be sure.

推荐答案

如果您下载的软件包apache-maven-3.3.9不包含bin文件夹,则您的下载错误.您必须下载一个包含bin,boot,conf,lib文件夹的zip文件,否则出现问题.下载的文件应具有约4.8 mb的大小.您可以通过md5或SHA1校验和检查文件.

If your downloaded package apache-maven-3.3.9 does not contain a bin folder your download is wrong. you have to download a zip file which contains bin, boot, conf, lib folder otherwise there has gone something wrong. The downloaded file should have about 4.8 mb size. You can check the file via md5 or SHA1 checksums.

这篇关于Maven M2_HOME设置为无效目录(Windows 7)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆