缺少 maven .m2 文件夹 [英] Missing maven .m2 folder

查看:33
本文介绍了缺少 maven .m2 文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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 上,这解析为 Users 而在 XP 上,它是 Documents and Settings.m2.所以你通常会在 c:UsersJonathan.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:UsersJonathan.m2.

如果您想在 Windows 上创建一个带有 . 前缀的文件夹,您只需在命令行上执行此操作即可.

If you want to create a folder with a . prefix on Windows, you can simply do this on the command line.

  • 转到开始->运行
  • 输入cmd并按回车
  • 在命令提示符下键入 md c:UsersJonathan.m2(或与您的 ${user.home} 值等效的值).
  • Go to Start->Run
  • Type cmd and press Enter
  • At the command prompt type md c:UsersJonathan.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).

如果您不需要单独的用户设置文件,并且真的不希望您的用户主目录下的本地存储库,您可以通过修改全局设置文件(位于confsettings.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 confsettings.xml).

以下代码片段将本地存储库设置为 c:Maven epository 例如:

The following snippet would set the local repository to c:Maven epository 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
epository</localRepository>
  ...

这篇关于缺少 maven .m2 文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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