缺少Maven .m2文件夹 [英] Missing maven .m2 folder
问题描述
AFAIK maven没有适用于Windows的安装程序,您可以按照自己的意愿将其解压缩,如此处.
AFAIK maven does not have an installer for Windows, you simply unzip it wherever you like, as explained here.
但是,在许多地方,在用户文件夹下都引用了一个.m2
文件夹(在Win7中,我猜它默认为C:\Users\.m2
.可惜我没有该文件夹.是否有一些命令可以创建?这个文件夹吗?我缺少基本的东西吗?
However in many places there are references to a .m2
folder under the user folder (in Win7 I would guess it to be by default at C:\Users\.m2
. Alas I do not have that folder. Is there some command to create this folder? Am I missing something basic?
推荐答案
在Windows计算机上,.m2文件夹应位于${user.home}
下.在Windows 7和Vista上,此解析为<root>\Users\<username>
;在XP上,其解析为<root>\Documents and Settings\<username>\.m2
.因此,通常您会在c:\Users\Jonathan\.m2
下看到它.
On a Windows machine, the .m2 folder is expected to be located under ${user.home}
. On Windows 7 and Vista this resolves to <root>\Users\<username>
and on XP it is <root>\Documents and Settings\<username>\.m2
. So you'd normally see it under c:\Users\Jonathan\.m2
.
如果要在Windows上创建带有.
前缀的文件夹,只需在命令行上进行操作即可.
If you want to create a folder with a .
prefix on Windows, you can simply do this on the command line.
- 转到开始-> 运行
- 键入 cmd ,然后按 Enter
- 在命令提示符下,键入 md c:\ Users \ Jonathan \ .m2 (或等价于您的$ {user.home}值).
- Go to Start->Run
- Type cmd and press Enter
- At the command prompt type md c:\Users\Jonathan\.m2 (or equivalent for your ${user.home} value).
请注意,除非您想要创建一个不同的用户设置文件(这是可选的),否则实际上并不需要 .m2 位置(请参阅
Note that you don't actually need the .m2 location unless you want to create a distinct user settings file, which is optional (see the Settings reference for more details).
如果您不需要单独的用户设置文件,并且实际上不希望本地存储库位于用户主目录下,则可以通过修改全局设置文件(位于\中,将存储库的位置设置为其他文件夹) conf \ settings.xml).
If you don't need a separate user settings file and don't really want the local repository under your user home you can simply set the location of your repository to a different folder by modifying the global settings file (located in \conf\settings.xml).
例如,以下代码片段会将本地存储库设置为c:\Maven\repository
:
The following snippet would set the local repository to c:\Maven\repository
for example:
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>c:\Maven\repository</localRepository>
...
这篇关于缺少Maven .m2文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!