没有(远程)存储库的Maven? [英] Maven without (remote) repository?

查看:84
本文介绍了没有(远程)存储库的Maven?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Maven 2多模块项目,并希望确保所有内容都取自我的本地已签出源.

I have a Maven 2 multi-module project and want to be sure everything is taken from my local checked-out source.

  • 是否可以告诉Maven永远不要为其源代码的模块下载任何内容?我必须禁用远程存储库吗?
  • Maven是否总是必须采用昂贵的方法将模块安装到本地存储库中,然后为每个依赖项再次提取模块?
  • 如果Maven的本地源更改了,Maven是否会自动重新编译模块的依赖关系,然后再编译依赖关系?

推荐答案

是否可以告诉Maven永远不要为其源代码的模块下载任何内容?

Is it possible to tell Maven to never download anything for the modules it has the source of?

不. Maven 2在构建时仅看到"当前模块.从好的方面来说,您可以通过在模块中运行Maven来构建树的一部分.

No. Maven 2 only "sees" the current module while it builds. On the plus side, you can build part of the tree by running Maven in a module.

我必须禁用远程存储库吗?

Do I have to disable the remote repositories?

是的,请使用离线"选项-o-offline.或将settings.xml与没有任何文件的代理一起使用.不过,这不是您想要的.

Yes, use the "offline" option -o or -offline. Or use settings.xml with a proxy that doesn't have any files. This isn't what you want, though.

Maven是否总是必须采用昂贵的方法将模块安装到本地存储库中,然后为每个依赖项再次提取模块?

Does Maven always have to go the expensive way of installing a module into the local repository, and then extracting it again for each of its dependents?

是的,但并不昂贵.在构建过程中,文件被复制(十年前很昂贵).使用依赖项时,Maven只会将文件的路径添加到Java进程中.因此,该文件不会再次复制或修改. Maven假定本地存储库中的文件没有更改(或只有在下载/安装时才更改一次).

Yes but it's not expensive. During the build, the file is copied (that was expensive ten years ago). When a dependency is used, Maven just adds the path to the file to the Java process. So the file isn't copied or modified again. Maven assumes that files in the local repository don't change (or only change once when a download/install happens).

如果Maven的本地源更改了,Maven是否会自动重新编译模块的依赖关系?

Does Maven automatically first recompile dependencies for a module if their local source changed?

不.有Maven 3的计划,但我找不到启用类似功能的选项.

No. There were plans for Maven 3 but I can't find an option to enable something like that.

要解决您的问题,您应该安装本地代理(例如 Nexus ).

To solve your issues, you should install a local proxy (like Nexus).

这篇关于没有(远程)存储库的Maven?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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