没有互联网连接的 Maven

发布于 2024-11-19 01:03:07 字数 965 浏览 3 评论 0原文

我是 Maven 项目的新手。 我正在将 ant 项目更改为 Maven 项目。 为了在 Maven 本地存储库中安装第 3 方 jar,我使用了 install 命令。 它尝试下载资源 jar.pom。 我在我的组织中没有下载权限,因此构建安装失败。 经过请求,我在桌面上得到了资源罐和干净的罐子(我也可以得到其他必要的罐子)。 如何使 Maven 在该过程中使用这些 jar 以及如何在没有互联网访问的情况下将 jar 安装在本地存储库中。

我下载了该 jar 并放置在本地存储库中,但它无法指向路径并使用这些 jar。

请让我知道我在没有互联网访问的情况下运行 maven install 和其他命令来构建项目所遵循的步骤。

我应该把通过外部方式下载的 jar 放在哪里。

请指导我构建和部署该项目。

提前致谢。

http://maven.40175.n5.nabble.com/Maven-installation-and-using-in-project-without-Internet-conncetion-tp4564443p4564443.htmlhttp://www.coderanch .com/t/544641/Jobs-Offered/careers/Maven-installation-project-without-Internet#2471141

我在这些链接中发布了同样的问题

I'm new to maven project.
I'm changing an ant project to maven project.
To install the 3rd party jar's in maven local repository, I used install command.
Its trying to download the resource jar.pom.
I don't have download access in my organization so the build failed for installtion.
After request i got the resouce jar and clean jar in my desktop(also i can get other necessary jar).
How to make maven to use these jar for the process and how to install the jar in local repository without internet acess.

I downloaded the jar and placed in local repository but it couldn't point the path and use those jars.

please let me know what steps i have follow to run maven install and other commands to build the project without internet access.

where should i placed the jar which i have downloaded by external way.

Please guide me for building and deploying the project.

Thanks in advance.

http://maven.40175.n5.nabble.com/Maven-installation-and-using-in-project-without-Internet-conncetion-tp4564443p4564443.html.
http://www.coderanch.com/t/544641/Jobs-Offered/careers/Maven-installation-project-without-Internet#2471141

I've posted same question in these link

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

满栀 2024-11-26 01:03:07

需要互联网连接。 Maven 最初并不是自给自足的。它需要下载一堆插件及其依赖项以及您自己项目的依赖项。这实际上取决于您的项目的设置类型。一种设置需要一组依赖项,另一组则需要一组完全不同的依赖项。您无法手动从 Maven Central 下载工件,然后将它们一一安装在本地。简而言之,这听起来很愚蠢。

我知道您来自 Ant 世界,Ant 在本地文件系统上拥有它所需的一切。然而,Maven 依赖于这样一个事实:它有一个中央存储库(Maven Central 或您自己的存储库 - Nexus、Artifactory 等),可以从中下载所需的插件和依赖项。除非您被允许访问中央 Maven 存储库,否则迁移到 Maven 是没有意义的。

是的,确实,您可以离线运行 Maven,并且您可以让 Maven 生成一个本地存储库供您使用当您处于离线模式时。 但是,您尝试做的事情违反了 Maven 的原则。

如果您的公司不允许访问 Maven Central,请坚持使用 Ant。您的努力将浪费公司的时间,并最终浪费您自己的时间。

You need an internet connection. Maven isn't initially self-sufficient. It needs to download a bunch of plugins along with their dependencies and the dependencies of your own project. And this really depends on what sort of settings you have for your projects. One set up will require one set of dependencies, another - a whole different one. You can't download artifacts from the Maven Central manually and then install them locally one by one. Simply put, that sounds stupid.

I understand that you're coming from the Ant world where Ant has everything it needs on the local file system. However, Maven relies on the fact that it will have a central repository (either Maven Central, or your own repository - Nexus, Artifactory, etc.) from which to download the plugins and dependencies it needs. There is no point in you migrating to Maven, unless you'll be allowed access to the Central Maven Repository.

Yes, indeed, you can run Maven offline and you can have Maven produce a local repository for you to use when you are in offline mode. However, what you're trying to do is against Maven's principles.

If your company won't allow access to Maven Central, just stick to Ant. Your effort will be a waste of your company's and, ultimately, your own time.

兮子 2024-11-26 01:03:07

事实上,maven 的优势主要在于可通过互联网访问的存储库和自动依赖管理。但是,如果您的本地存储库中拥有项目所需的所有依赖项,则可以使用此工具来构建项目。然后你可以使用 -o 选项进行离线模式,maven 将不会尝试下载更新的 artefact 版本。

要将工件放入本地存储库,您有多种选择:

1)连接到互联网并 mvn 构建项目(这将下载所有必需的依赖项)

2)手动将依赖项作为 jar 安装到本地存储库(使用适当的 mvn 命令)

In fact the maven strenght is mainly in the internet accessible repositories and automatic dependency management. But it's possible to use this tool to build your project if you have all dependencies required for your project in your local repository. Then you may use -o option for offline mode and maven will not try to download updated artefact versions.

To get the artifacts into you local repository you have several options:

1) connect to the internet once and mvn build the project (this will download all required dependencies)

2) install dependencies as jar to the local repository manualy (using appropriate mvn command)

唱一曲作罢 2024-11-26 01:03:07

您可以将 Maven 配置为以离线模式运行。将此条目添加到您的 settings.xml

<offline>true</offline>

请参阅此处以获取更多信息:

http:// maven.apache.org/settings.html

在使用离线模式之前,您必须将所有必需的第三方 jar 安装到本地 maven 存储库。

mvn install:install-file
 -Dfile=filename.jar
 -DgroupId=com.stackoverflow
 -DartifactId=artifact
 -Dversion=1.0.0
 -Dpackaging=jar
 -DcreateChecksum=true
 -DgeneratePom=true

使用互联网连接和在线模式将这些 jar 放入本地存储库要容易得多。

You can configure maven to run in offline mode. Add this entry to your settings.xml

<offline>true</offline>

See here for further information:

http://maven.apache.org/settings.html

Before you can use offline mode, you have to install all necessary third party jars to your local maven repository.

mvn install:install-file
 -Dfile=filename.jar
 -DgroupId=com.stackoverflow
 -DartifactId=artifact
 -Dversion=1.0.0
 -Dpackaging=jar
 -DcreateChecksum=true
 -DgeneratePom=true

It's much easier to get those jars in your local repository using an internet connection and online mode.

请止步禁区 2024-11-26 01:03:07

我认为提问者正在寻找 mvn 的 -o 或 --offline 选项。这是一个命令行选项,可以在执行时提供。

我认为您可以正确设置您的存储库,并在连接到互联网时执行一次 mvn 目标,并使用 -o 选项进行以后的执行。

希望这有帮助。

~阿巴伊

I think the questioner is looking for -o or --offline option for mvn. This is a command line option and can be provided while executing.

I think you can setup your repo correctly and execute the mvn goals once when you are connected to internet and use the -o option for later executions .

Hope this helps.

~Abhay

陪你到最终 2024-11-26 01:03:07

可以使用 在本地 Maven 存储库中安装这些资源 jar安装文件。这将使构建可用。您必须为每个人单独执行此操作,但一旦完成,您将无需执行任何特殊操作。

需要明确的是,maven 将所有内容放入您的本地存储库中,包括您使用此项目构建的 jar 和各种库 jar。由于您的系统无法连接到互联网,因此 Maven 无法使用您的库填充本地存储库,因此您必须使用此手动方法。

编辑:您应该能够在任何地方运行install-file。执行此操作时,您需要使用命令行选项提供 groupId、artifactId、版本和打包。如果您已经有该库的 POM 文件,则可以通过 -DpomFile=your-pom.xml 提供该文件。

这个问题有一些有用的信息:如何手动安装工件Maven 2?

It's possible to install these resource jars in your local maven repo using install-file. This will make the available to the build. You'll have to do this for each individually, but once that's done you won't have to do anything special.

To be clear, maven puts everything in your local repository, both the jar you're building with this project and the various library jars. Because your system cannot be connected to the internet to maven can populate the local repo with your libraries, you'll have to use this manual approach.

Edit: You should be able to run install-file anywhere. When you do, you'll need to provide the groupId, artifactId, version, and packaging using the command line options. If you already have a POM file for the library, you can provide that instead via -DpomFile=your-pom.xml.

This question has some useful info: How to manually install an artifact in Maven 2?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文